Database Migrations
Learn how to safely perform database migrations while maintaining data replication with Artie.
Overview 🎯
Database migrations are a critical part of maintaining and upgrading your database infrastructure. This guide explains how to safely perform database migrations while ensuring your data replication continues to work correctly with Artie.
Major version upgrade ⚠️
Major version upgrades (e.g., PostgreSQL 14 to 15) require stopping database replication to perform the necessary upgrade and restart your database. This is because major version upgrades often include breaking changes that can affect replication.
Steps to perform major version upgrades without data loss:
If you are using Postgres, make sure to drop the replication slot after you paused the Artie deployment. See the Postgres tips section for more information.
- Schedule an application downtime and pause your application.
- Check that Artie is no longer processing any data from our Analytics portal and pause your Artie deployment.
- Perform the database upgrade and restart your database server.
- Resume your Artie deployment.
- Resume your application.
Database-specific considerations
Minor version upgrade
Minor version upgrades (e.g., PostgreSQL 14.1 to 14.2) do not require stopping database replication. These upgrades are typically handled automatically by your database provider and applied during your maintenance window.
While minor version upgrades are generally safe, it’s still recommended to:
- Monitor your replication lag during the upgrade
- Have a rollback plan ready
- Test the upgrade in a staging environment first
Best practices ⭐
- Always test migrations in a staging environment first
- Back up your data before any major version upgrade
- Monitor replication lag during and after the upgrade
- Keep your Artie deployment paused until the upgrade is complete
- Verify data consistency after the upgrade
Troubleshooting 🔧
Was this page helpful?