0

Is there a place we can keep track of magento2 database table each time it's updated. I found this would be helpful for people who already start using magento2. Simplest scenario, user can backup the whole database where there are already hundreds of products and store configuration and re-use it safely on new magento version.

Due to the change of database schema, simple dump and import the whole database from old version magento to new version magento would sometimes break integrity. Therefore, knowing which table schema changed in each certain update is necessary to avoid data corruption and thus remain integrity.

If the above hard to understand what it means, then here is a real world question: How Can I import the whole database backup file to new magento installation for products/store configuration etc. data without break the new magento system?

0

The schema of the database is versioned and the data that is inserted/updated/deleted from the code.
There is a table called setup_module
this table contains 3 fields:

+----------------+-------------+------+-----+---------+-------+
| Field          | Type        | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| module         | varchar(50) | NO   | PRI | NULL    |       |
| schema_version | varchar(50) | YES  |     | NULL    |       |
| data_version   | varchar(50) | YES  |     | NULL    |       |
+----------------+-------------+------+-----+---------+-------+

The first one is the module name. The second is the module schema version and the third one is the data version. Usually schema_version and data_version match. They are different only during an upgrade.
So you don't need to worry about the schema. You can use an older version of the db for a newer version of the project and everything should be updated nicely after running in the console bin/magento setup:upgrade.
but you cannot track changes that are done manually. Like adding/editing products from the admin, or any other change you do from the admin panel.

  • Thanks. I think it's going to work out well thanks to the module setup/upgrade mechanism. But I'm worried a bit because I have two magento2.1 installation installed at different point of time. One come with 317 tables and the newest one (install about one month ago) has 315 tables. – Nero Aug 4 '16 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.