When I was creating a module I notice a new thing in Magento 2.3. Magento 2.3 core modules used a declarative schema approach instead of a setup upgrade script. This is a new recommended approach in Magento 2.3 and above.
Declarative schema reduces the unnecessary work of writing upgrade scripts for just a little change in the database. For example, If you want to rename a column, you need not write a setup upgrade schema script in the next version of that module. You can change the schema in db_schema.xml and run the setup upgrade command.
This allows the developer to declare the final state of the database. As a result, it will reduce redundant operations. It reduces the process of writing code in the next version. Because of this approach, you can delete data when you uninstall the module.
How to create a table using Declarative Schema in Magento 2.3
In this blog, the process of creating a table using declarative schema is explained.
First of all, Create the db_schema.xml file under the “StageBit/DeclarativeSchema/etc” directory and write the following code.
Click Here the Link and Get Cod:-
Sign in to leave a comment.