Database Upgrade Scripts - richjoslin/rivety GitHub Wiki
Database upgrade script documentation currently in the works...
- Add new SQL scripts to [webroot]/modules/mymodulename/sql/[engine]/
- Upgrade scripts must be named sequentially starting with dbupgrade_0001.sql
- After adding a new upgrade script, you must change that module's module.ini in order for the change to take effect. The parameter is in the database_versions section of the ini, it's named the same as the module name, and should be the only setting under database_versions.
- Once the module.ini is changed, the upgrades are executed immediately upon hitting any Rivety controller action (even the home page).
- Deleting an upgrade script after it has executed is generally a bad idea, except in certain cases. See the next bullet for one of those cases.
- Before releasing a module to the public, it's a good idea to "merge" all your db upgrades. This is best done by deleting them all, and replacing install.sql with your latest and greatest database creation code, then rolling the module db version back to 0.
- Downgrade scripts are not a thing yet.
- Failures in upgrade SQL scripts scripts are silent.
- Comments in your upgrade SQL scripts cause silent failures.