The schema scripts is to create a database structure. For example, creating a table and add columns to existing table. The install data scripts is to manage the data within existing tables, adding some sample data to tables.
At first time, we run php bin/magento setup:upgrade
, Magento will execute the files in following order: (Creating table structure first, and then add the data to table)
- InstallSchema.php
- UpgradeSchema.php
- InstallData.php
- UpgradeData.php
In the next time, run setup upgrade command again, only two files:
- UpgradeSchema.php
- UpgradeData.php
So in your case, when editing the install data script that will not effect your database anymore. If we want to re-install, we may need to remove our module from table setup_module
table (and, may need to remove the old database). And run setup upgrade command again.
For the adding new order attribute, we should take a look: http://magento.stackexchange.com/a/131969/33057https://magento.stackexchange.com/a/131969/33057