Skip to content

Preparation for update with database schema changes

Aurora Lahtela edited this page Oct 30, 2022 · 5 revisions

Plan Header

Preparation for update with database schema changes

If an update has backwards incompatible database schema changes it is mentioned in the change log.

  • Backup your database
  • Stop all servers
  • Update all servers
  • Start one server with Plan and wait until Patching has completed ("All database patches applied successfully.")
  • Start rest of the servers

If you need a rough estimate how long patching will take, you can run query SELECT COUNT(*) as row_count FROM <table name mentioned in change log> and estimate.
Patching the database usually takes ~1 second per 20000 rows of data.

How to Backup your database

SQLite

  • Stop your server
  • Go to Plan plugin directory
  • Make sure that database.db-shm and database.db-wal files are not present
    • If they are the server didn't shut down properly, restart the server and stop it.
  • Copy database.db to your backup folder
How to restore if something goes wrong
  • Stop your server
  • Go to Plan plugin directory
  • Make sure that database.db-shm and database.db-wal files are not present
    • If they are the server didn't shut down properly, restart the server and stop it.
  • Copy database.db to your Plan folder from your backup folder

MySQL

How to restore if something goes wrong
  • Login to mysql
  • mysql> drop database {broken plan database};
  • mysql> source /path/to/backup-plan-dump.sql
Clone this wiki locally