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
The tables page allows you to view all the tables in your project.
Table detail
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.
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 declarationetc/db_schema_whitelist.json
: created if it does not exist, or updated with the new table declarationModel/ModelName.php
: created with the new model classModel/ResourceModel/ModelName.php
: created with the new model resource classModel/ResourceModel/ModelName/Collection.php
: created with the new model collection class