Tools: Flyway, Liquibase, Sqitch
Compare popular schema migration tools, their versioning models, and CI integration.
Why Migration Tools?
Schema changes need to be:
- Versioned in source control
- Applied in a deterministic order
- Run automatically in CI/CD
- Rollback-able (sometimes)
Flyway
Java-based, file-based migrations. Each file is named with a version prefix:
-- V1__create_users.sql
CREATE TABLE users (id BIGSERIAL PRIMARY KEY, email TEXT NOT NULL);
-- V2__add_full_name.sql
ALTER TABLE users ADD COLUMN full_name TEXT;
-- Flyway tracks applied migrations in a flyway_schema_history table.All lessons in this course
- Online Migrations: Why ALTER TABLE Locks
- Concurrent Indexes (CREATE INDEX CONCURRENTLY)
- Zero-Downtime Column Renames
- Tools: Flyway, Liquibase, Sqitch