This page documents the use of admin tools to create a database or update an existing database to the latest schema based on the current state of the model objects..
- MySQL database must already exist (e.g. "refset")
- MySQL database connection parameters must be defined in the properties file specified by "refset.config".
- IMPORTANT: The Tomcat server must not be running while this is invoked.
- IMPORTANT: If you are trying to destroy and recreate the database
- First run the contents of admin/src/main/resources/truncate_all.sql into your database
- Also, make sure to clear your index files (or immediately run the Reindex Objects tool).
- IMPORTANT: To update an existing database (to add fields, etc), make sure to run with -PUpdatedb instead of -PCreatedb
This tool is used to either create a database for the tool, or update an existing schema based on changes in the code (while retaining data and indexes already loaded)
Following are some details about the implementation of this tool:
Mojo: UpdateDbMojo.java (in admin/src/main/resources/java/org/ihtsdo/otf/refset/mojo)
- "Createdb" - for creating a database
- "Updatedb" - for updating an existing schema
refset.config - the standard configuration file specified as a -D parameter
Sample command line call of the admin tool to create a new database:
Sample command line call of the admin tool to update an existing schema:
The main issue with "Createdb" has to do with a legacy table structure with indexes or foreign keys that are no longer valid. Clear the state of the database first by either dropping and recreating the schema, or by running the contents of "admin/src/main/resources/truncate_all.sql" into your database.