Before you start migrating, you should:
- Ensure all your modules are up to date, especially if they use custom tables (schema definitions must properly mark NULL and BINARY columns)
- If you manually dropped tables before conversion, softreset first to make sure all rights tables are in sync
We recommed doing a dry-run of the migration first. A dryrun will generate the postgres tables but not move then into place for a switchover:
wh convert-to-postgresql --dryrun
Any records with invalid UTF-8 data will be printed.You may consider whether you can fix them or just accept a best-effort ISO-8859-15 -> UTF-8 for these fields. If some fields are still incorrect even after this fix, migration will fail.
Any converted cells will have their original values saved to webhare_internal.postgresql_migration_issues after the final migration.
Running the conversion
To actually do the conversion, remove the --dryrun parameter. This will prepare the postgres tables and WebHare will switch over to postgres database once it's restarted. If you're using docker and want to automatically restart after the conversion is done:
wh db setserver readonly && wh convert-to-postgresql && sv restart webhare
The time migration takes may vary (do a dry-run to have an estimate) and has taken anywhere between 5 seconds and 15 minutes for our own servers - database size and I/O speed matters a lot of course.
We recommend switching to readonly mode during migration, and accepting that this may break some webpages or applications which try to write to the database. If you do not disable database writes, you will lose any changes that were made since the start of the migration.
You can always revert back to the old database engine by deleting the /opt/whdata/postgresql directory and restarting WebHare, but you will lose all changes made since the migration. If you are satisfied with the results of your migration and have verified your backup/restore procedures, you can delete /opt/whdata/dbase.