v2.0.01 Upgrade Notes

Database Upgrade

  1. Create a backup of the current database instance. This backup is to be used in case of failure. You may also create an online database copy for a quick recovery using (using pgadmin or psql):

    -- CLONE DATABASE TO NEW ONE(TARGET_DB)
    CREATE DATABASE dirdb_backup WITH TEMPLATE dirdb;
    
  2. Run the database upgrade scripts from dbdef/changescripts. This will make required database schema changes. However, the database upgrade is not complete. You need to run the below steps as well.

  3. Create an export of the database using the pg_dump tool. Format should be a plain-text SQL file (default) with both schema and data.

  4. Update all UUIDs using a text editor that can open large files. Search for “-0000-0000-0000-” and replace it with “-0000-4000-8000-”. Quotes are not to be in the search or replacement string.

  5. Drop all tables and views in the database to be updated.

  6. Use psql to run the updated file. This will import the database.

  7. Run the database seed script to update metadata (connection string depends on system installation):

    psql --file seed_directory_db.pgsql  postgres://<user>:<password>@<host>:<post>/<dbname>