Skip to content

Tables

NOTE

As there is no "clear" relation between tables and models, tables are listed from their declarations in db_schema.xml. In the future, we may add a feature to identify models related to a table, from the \Magento\Framework\Model\ResourceModel\Db\AbstractDb::_init call in the resource model.

Global tables list

Tables list

The tables page allows you to view all the tables in your project.

Table detail

Table view

In the table detail view, you can see more details about the table:

  • Columns
  • Indexes
  • Constraints (foreign keys, primary keys)

Module tables list

In the module detail view, you can see the tables declared by this module.

Module model and table creation

You can create a new model with it's table declaration by clicking Generate > Model button from the module detail view.

Table create

The module model creation wizard includes the following features:

  • Auto-generate table, index and constraint names
  • Allow you to select which columns, indexes and constraints should be added to the table
  • Autocomplete the list of available columns when creating an index or constraint

The following files are created/updated in app/code/Vendor/Module when you create a new model:

  • etc/db_schema.xml: created if it does not exist, or updated with the new table declaration
  • etc/db_schema_whitelist.json: created if it does not exist, or updated with the new table declaration
  • Model/ModelName.php: created with the new model class
  • Model/ResourceModel/ModelName.php: created with the new model resource class
  • Model/ResourceModel/ModelName/Collection.php: created with the new model collection class

Released under the MIT License.
This project is not affiliated with, endorsed by, or sponsored by Adobe Inc. "Magento" and "Adobe Commerce" are trademarks of Adobe Inc.
All trademarks and registered trademarks are the property of their respective owners.