-
Notifications
You must be signed in to change notification settings - Fork 32
Changing the database schema
Michael Srocka edited this page Mar 27, 2014
·
1 revision
openLCA supports evolution of the underlying database schema and the automatic update of databases. If you want to change the database schema (e.g. by adding a field) and you do the following steps, the openLCA application will automatically update databases and apply your changes:
- Change the database schemas: make your changes to the databases schemas for Derby (current_schema_derby.sql) and MySQL (current_schema_mysql.sql) in the resource folder.
- Increment the database version: increment the field CURRENT_VERSION in the IDatabase interface and the field openlca_version.version in both database schemas (the insert statement under the table definition)
- Write an update that implements IUpgrade (see the upgrades package) and add your update to the updates field of the Upgrades class. You can use the UpgradeUtil class which already provides a set of functions (e.g. creating tables, adding columns etc.).