Keep the verion of the database model updated, using a MySQL script.
With this script, you can keep the version of the database model without needing another tool than MySQL console.
It is the simplest and easiest way to perform this task so common, without the need to using other extra tools.
To work, creates an auxiliar database table (database_version) to register the executed scripts, and prevent to execute any executed script.
- Very easy to implement.
- No additionals components required.
- No need to learn a new language.
- No need to learn a new syntax.
Simply change the database name to use, or remove it for manually select.
USE databaseName
source /path/to/db_updater.sql;
If "USE database" is removed, then:
USE databaseName; source /path/to/db_updater.sql;
mysql -u USER -p < /path/to/db_updater.sql
or
mysql -u USER -pPASS databaseName < /path/to/db_updater.sql