рдореБрдЦреНрдп рдордЬрдХреБрд░рд╛рдХрдбреЗ рдЬрд╛
JobCannon
рд╕рд░реНрд╡ рдХреМрд╢рд▓реНрдпреЗ

Database Migration Strategies

тмв рд╢реНрд░реЗрдгреА 3рддрд╛рдВрддреНрд░рд┐рдХ
+$30тАУ50k
рдкрдЧрд╛рд░рд╛рд╡рд░реАрд▓ рдкрд░рд┐рдгрд╛рдо
5 рдорд╣рд┐рдиреЗ
рд╢рд┐рдХрдгреНрдпрд╛рд╕ рд▓рд╛рдЧрдгрд╛рд░рд╛ рд╡реЗрд│
рдордзреНрдпрдо
рдХрд╛рдард┐рдгреНрдп
2
рдХрд░рд┐рдЕрд░реНрд╕
рдПрдХрд╛ рджреГрд╖реНрдЯрд┐рдХреНрд╖реЗрдкрд╛рдд

Database migrations are how teams safely evolve production schemas. Expert patterns: expand-contract (add column, backfill, drop), dual-write (shadow traffic), blue-green (switch databases), online DDL tools (gh-ost, pt-online-schema-change). Career path: Junior (basic migrations, Liquibase, 4-6 months) тЖТ Senior (zero-downtime orchestration, $135-185k). Certification: AWS DBS Specialty, Liquibase certified, Flyway docs.

Database Migration Strategies рдореНрд╣рдгрдЬреЗ рдХрд╛рдп

Database migrations are controlled schema and data evolution: adding columns, changing types, creating indices, backfilling data, and dropping old schema, all without downtime. The stakes are high: a bad migration can take production down, corrupt data, or cause prolonged recovery. Strategies span offline (downtime-required, simple rollback) to online (continuous traffic, complex tooling), frameworks (Liquibase, Flyway, Prisma Migrate), and deployment patterns (expand-contract, blue-green databases, shadow writes). Large-scale systems (100GB+ tables, billions of rows) require specialized tools (gh-ost, pt-online-schema-change, AWS DMS) and careful orchestration. Backend engineers who master migration safety command +$30тАУ50k premium over those who cause production incidents. The salary impact is moderate (+$10тАУ20k) but concentrated in senior/staff engineer roles where schema management defines infrastructure reliability. At scale (>$1B revenue), a single poorly-planned migration affecting 10k+ users = customer churn, SLA violation, and C-suite stress. Companies now hire "data platform" or "database reliability" engineers specifically to design safe migration frameworks. Stripe, Uber, Airbnb published case studies on zero-downtime migration patterns; mastering these patterns is expected for infrastructure-track engineers.

ЁЯФз рд╕рд╛рдзрдиреЗ рдЖрдгрд┐ рдкрд░рд┐рд╕рдВрд╕реНрдерд╛
LiquibaseFlywayPrisma migrateDrizzle migrategh-ostpt-online-schema-changeAWS DMSAzure DMSStriimDebeziumFivetranAirbyteSchemachange

ЁЯУЛ рд╕реБрд░реВ рдХрд░рдгреНрдпрд╛рдкреВрд░реНрд╡реА

ЁЯТ░ рдкреНрд░рджреЗрд╢рд╛рдиреБрд╕рд╛рд░ рдкрдЧрд╛рд░

рдкреНрд░рджреЗрд╢рдЬреНрдпреБрдирд┐рдпрд░рдордзреНрдпрдорд╕реАрдирд┐рдпрд░
USA$105k$155k$210k
UK┬г65k┬г95k┬г140k
EUтВм75kтВм110kтВм155k
CANADAC$115kC$165kC$225k

ЁЯОУ рдкреНрд░рдорд╛рдгрдкрддреНрд░реЗ

ЁЯОп Database Migration Strategies рд╡рд╛рдкрд░рдгрд╛рд░реА рдХрд░рд┐рдЕрд░

тЪЦ рдпрд╛рдВрдЪреНрдпрд╛рд╢реА рддреБрд▓рдирд╛ рдХрд░рд╛

тЭУ FAQ

Online vs offline migrations, what's the difference?
Offline: downtime required, lock tables, simple rollback. Online: serves traffic during migration, uses triggers/dual-write/shadow reads, more complex but zero-downtime. For large tables (> 100GB): always online. Tools: gh-ost, pt-osc (MySQL), Liquibase online config. Offline works for small tables or during maintenance windows. AWS DMS handles large cross-database migrations online with CDC (Change Data Capture).
How do dual-write patterns work?
Write new schema + old schema in parallel for 1-2 days, read from old schema. Verify new schema data matches. Flip reads to new schema. Drop old schema. Catches data inconsistencies before cutover. Risk: code complexity, schema mismatch bugs. Alternative: expand-contract (safer, slower).
Blue-green migration strategy, when should I use it?
Set up identical database clusters (blue=live, green=standby). Migrate green while blue serves traffic. Test green thoroughly. Flip traffic to green. Keep blue as rollback for 24h. Best for: cross-database migrations (PostgresтЖТMySQL), major version upgrades, schema overhauls. Cost: 2x database cost during migration. Trade-off: safest approach, highest cost.
What's the expand-contract pattern?
Phase 1: ADD COLUMN new_column. Phase 2: backfill new_column from old_column via batch jobs. Phase 3: flip code to read from new_column. Phase 4: DROP COLUMN old_column. Each phase deployable independently. Slowest approach but safest, zero-downtime, reversible at each step. Used by Google, Facebook for massive tables.
Large table migrations (1TB+), tactics?
Never LOCK TABLE. Use gh-ost (online DDL, triggers, shadow table) or AWS DMS (CDC + replication). Chunk data with row IDs in batches (10k rows/sec). Monitor replication lag. For index changes: rebuild online or drop+recreate in parallel. Test on production-sized replica first. Budget: hours to days depending on table size.
Rollback strategies for failed migrations
Test rollback plan BEFORE migrating: reverse migration scripts, backup-restore window, CDC rewind (Debezium). Keep last 7 days snapshots. For expand-contract: rollback = revert code, old column still there. For blue-green: instant (flip traffic back). For online DDL: rollback = abort tool, old table preserved. Document rollback SLO per migration type.
Cross-cloud migrations (AWS Postgres to Azure)
Use AWS DMS (source) + replication тЖТ Azure. Or Fivetran/Airbyte for data sync + custom schema migration. Schema-first approach: migrate DDL via Liquibase, then data. Test on non-prod first. Network latency matters: direct connection > VPN. 1TB takes 8-24h depending on latency. Plan cutover window. Verify foreign keys, sequences, triggers exist on target.

рд╣реЗ рдХреМрд╢рд▓реНрдп рддреБрдордЪреНрдпрд╛рд╕рд╛рдареА рдпреЛрдЧреНрдп рдЖрд╣реЗ рдХрд╛, рдпрд╛рдЪреА рдЦрд╛рддреНрд░реА рдирд╛рд╣реА?

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдЖрдореНрд╣реА рдпреЛрдЧреНрдп рдорд╛рд░реНрдЧ рд╕реБрдЪрд╡реВ.

рдорд╛рдЭреНрдпрд╛рд╕рд╛рдареА рд╕рд░реНрд╡реЛрддреНрддрдо рдХреМрд╢рд▓реНрдпреЗ рд╢реЛрдзрд╛ тЖТ

рддреБрдордЪрд╛ рдЖрджрд░реНрд╢ рдХрд░рд┐рдЕрд░ рдорд╛рд░реНрдЧ рд╢реЛрдзрд╛

реи,релреирез рдХрд░рд┐рдЕрд░рдордзреНрдпреЗ рдХреМрд╢рд▓реНрдпрд╛рдВрд╡рд░ рдЖрдзрд╛рд░рд┐рдд рдЬреБрд│рдгреА. рдореЛрдлрдд, ~3 рдорд┐рдирд┐рдЯреЗ.

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдореЛрдлрдд тЖТ