-
-
Notifications
You must be signed in to change notification settings - Fork 171
Preparation for update with database schema changes
Aurora Lahtela edited this page Oct 30, 2022
·
5 revisions
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.
- Stop your server
- Go to Plan plugin directory
- Make sure that
database.db-shm
anddatabase.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
anddatabase.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
- https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html
mysqldump {login options} {plan database name} > backup-plan-dump.sql
- Copy the dump file to your backup folder
How to restore if something goes wrong
- Login to mysql
mysql> drop database {broken plan database};
mysql> source /path/to/backup-plan-dump.sql