This is a checklist of where and how to make changes when the persistence layer is altered
- In netarchivesuite_init.sql , make the necessary postgresql schema change. Increment the version of the relevant table(s) in the schemaversions table by 1. Note that the script is only used for new, clean, install of NAS, so this doesn't address the issue of how you upgrade existing installation.
- Update createfullhddb.mysql and createfullhddb.sql to parallel the changes you made in the postgresql schema.
- In HarvesterDatabaseTables.java, update the required version of your table(s).
- Look at the method DBSpecifics.updateTable(). The list of else/ifs at the end should include a call to upgrade your table(s). If it doesn't, add the method and call to the class.
- For each table upgrade a specific asbtract migrate<tablename>v<N>to><N+1>() method to DBSpecifics. (Rarely you may be able to add it as a concrete method if the implementation is the same for all dbs). The upgradeTable method you created/edited in step 4 should explicitly call the new migrate method.
- Note that Nicholas has created a fantastic helper-method HarvestDBConnection.executeSql(...) which updates a database schema from an externally supplied .sql file. See usages in the codebase.
- Implemement the migrate method in every implementing class of DBSpecifics.