Module migration
Database migration scripts
-
up (db_path, scripts, target_version)
-
Perform database migration from lower to higher version
Parameters:
- db_path
path to the database we want to perform migration on
- scripts
array of {""}
- target_version
database version we want to migrate in to
Returns:
retcode
-
down (db_path, scripts, target_version)
-
Perform database migration from higher to lower version
Parameters:
- db_path
path to the database we want to perform migration on
- scripts
array of {""}
- target_version
database version we want to migrate in to
Returns:
retcode
-
get_db_version (db_path)
-
Read the database version
Parameters:
- db_path
path to the database
Returns:
database version number
-
migrate (db_dir, scripts_dir, db_set)
-
Perform databases migration(up/down) automatically
Parameters:
- db_dir
location of the databases
- scripts_dir
location of the database migration scripts
- db_set
array of {<"database_name"> = } entries
Returns:
retcode
-
retcode
-
Return codes
Fields:
- OK
- ALREADY_UP_TO_DATE
- WRONG_TARGET_VERSION