Skip to content

Database Patches

Nicolas Morales edited this page Mar 26, 2021 · 1 revision
  • Beginning with the v4.0 release of this Docker, database patches should automatically be run on startup; however, if something goes wrong, the following commands can help. In the docker-compose.yml, make sure to set RUN_DB_PATCHES=TRUE and provide the database parameters, as is done in the provided docker-compose.yml.

  • Database patch changes require you to run the database patch onto your database. Database patches can take long to complete, and so you should run them in a screen session. To do this, enter a screen session, then login to the running web docker using docker exec -it breedbase_web bash, then change directory to where the new database patch lives (e.g. cd /home/production/cxgn/sgn/db/00129), and finally run the patch onto your database using mx-run NameOfPatch -H breedbase_db -D empty_fixture -u janedoe. Notice, that the mx-run command uses NameOfPatch and not NameOfPatch.pm.

  • If you are updating across several versions (e.g. v1.3 to 1.7) and there are many database patches to run, you can use the run_all_patches.pl. Database patches can take long to complete, and so you should run them in a screen session. To do this, enter a screen session, then login to the running web docker using docker exec -it breedbase_web bash, then change directories to /home/production/cxgn/sgn/db, and finally run perl run_all_patches.pl -h breedbase_db -d empty_fixture -u postgres -p postgres -e janedoe.

  • When updating between major versions (e.g. v1 to v2) it is recommended to create database backups. Backup your database first by logging into where the database is running (e.g. docker exec -it breedbase_db bash) then create a backup to a file using pg_dump -U postgres empty_fixture > breedbase_fixture_v1_10122020.sql. Keep this backup safe!

Clone this wiki locally