For example i don't have setup scripts in My module,can i ignore setup_version
tag in module.xml
file.
In m1 automatically modules installed,now it's first throwing an error(if we don't run setup upgrade command).
Why I need to manually run setup upgrade?
What is the scenario schema_version
and data_version
will be different?
I observed almost records in setup_module table contain same values.
Best Answer
data_version
is the version of data added via the data scripts.Those scripts are developed under the module folder under the
Setup/InstallData.php
andSetup/UpgradeData.php
.schema_version
is the version of the database schema added via the setup scripts.Those scripts are developed under the module folder under the
Setup/InstallSchema.php
andSetup/UpgradeSchema.php
So the scenario when
data_version
andschema_version
are different is the following:php bin/magento setup:upgrade
so both schema and data scripts will runphp bin/magento setup:db-schema:upgrade
. At this point theschema_version
will be different to thedata_version
php bin/magento setup:db-data:upgrade
will upgrade the data and make both versions the same