upgrade_db − A tool to upgrade Emdros databases
upgrade_db [options] database-name
upgrade_db is a tool for upgrading Emdros databases created with Emdros version 1.1.7 or earlier to databases that work with Emdros version 1.1.8 and later.
For databases created with Emdros prior to version 1.1.0, the program does the following: For each object type OT in the database, it:
1) Adds a new column, is_first, to the OT_monad_ms table.
2) Adds some indices on OT_monad_ms and OT_objects (see EMdFDB::createIndicesOnOTObjects and EMdFDB::CreateIndicesOnOTMonadMs).
3) If using PostgreSQL, sets all is_first values in OT_monad_ms to ’N’.
4) Finds out which is_first values should be set to ’Y’.
5) Sets these to ’Y’. Each dot represents 500 rows.
6) Drops table OT_monad_ds.
After having dealt with all object types, the program creates two new tables, ‘sequence_0’ and ‘sequence_1’, and moves the values from the old ‘sequences’ table into these new tables. It then drops the old ‘sequences’ table.
For databases created with Emdros versions 1.1.0 to 1.1.4, the program does the following:
1) Creates the table max_m
2) Sets the values in this table to the maximum monad found in the database.
For databases created with Emdros versions 1.1.5 to 1.1.7, the program does the following:
1) Creates the tables/sequences sequence_118_0 and sequence_118_1 (tables on MySQL, sequences on PostgreSQL).
2) Moves the values from the old sequence_0 and sequence_1 tables to the new tables/sequences.
3) Drops the old sequence_0 and sequence_1 tables.
See the source in EMdF/emdfdb.cpp:EMdFDB::upgradeDatabase for the full story.
upgrade_db
supports the following command-line switches:
−−help
show help
−V , −−version
show version
−h , −−host hostname
set db back-end hostname to connect to (default is ’localhost’). Has no effect on SQLite.
−u , −−user user
set database user to connect as (default is ’emdf’). Has no effect on SQLite.
−p , −−password password
set password to use for the database user. Has no effect on SQLite, unless you have an encryption-enabled SQLite, in which case this gets passed as the key.
−b , −−backend backend
set database backend to ‘backend’. Valid values are: For PostgreSQL: "p", "pg", "postgres", and "postgresql". For MySQL: "m", "my", and "mysql". For SQLite 2.X.X: "2", "s", "l", "lt", "sqlite", and "sqlite2". For SQLite 3.X.X: "3", "s3", "lt3", and "sqlite3".
0
Success
1 Wrong usage
2 Connection to backend server could not be established
3 An exception occurred (the type is printed on stderr)
4 Could not upgrade
5 Database error
Written Ulrik Sandborg-Petersen (ulrikp@emdros.org).