10 Database Migration Anti-Patterns and What to Do Instead
Editing applied migrations, environment-specific scripts, ORM auto-DDL in production, untested rollbacks: ten habits that break deployments, with a fix for each.
Practical writing on database migrations, schema design, ER diagrams and the tooling around them. New articles every couple of weeks; there is an RSS feed.
Editing applied migrations, environment-specific scripts, ORM auto-DDL in production, untested rollbacks: ten habits that break deployments, with a fix for each.
How to change a live schema without an outage: expand, backfill in batches, switch reads and writes, then contract. With safe NOT NULL, renames and lock timeouts.
Run migrations against a throw-away real database on every change: a Testcontainers and Flyway example, CI service containers, version matrices and schema checks.
Type affinity, limited ALTER TABLE and foreign keys that are off by default: what breaks when you develop on SQLite and deploy to PostgreSQL, and how to avoid it.
What a schema is in SQL Server, why everything lands in dbo, how default schemas work, and how Flyway, Liquibase, EF Core, DbUp and FluentMigrator target schemas.
Oracle folds unquoted names to upper case, PostgreSQL to lower case, MySQL depends on a setting, SQL Server on collation. The rules, and how to stay out of trouble.
A practical guide to column types in PostgreSQL, MySQL, SQL Server, Oracle and SQLite: strings, timestamps, money, booleans, JSON, enums and what diagrams report.
Which engines run DDL in transactions (PostgreSQL, SQL Server, SQLite), which commit implicitly (MySQL, MariaDB, Oracle), and how to write migrations for both.
A practical comparison of PostgreSQL, MySQL and MariaDB: data types, SQL conformance, transactional DDL, replication, hosting and what each means for migrations.
How Diesel manages a schema in Rust: the CLI, timestamped folders with up.sql and down.sql, the versions table, the generated schema.rs and embedded migrations.
Doctrine Migrations in Symfony from setup to deploy: diff versus generate, the Version class, the versions table, reviewing generated SQL and running safely.
How Active Record migrations work, what schema.rb cannot express, when to switch to structure.sql, and how db:prepare and strong_migrations keep a team safe.
Practical rules for Laravel migrations in a team: one change per file, constrained foreign keys, frozen history, schema dumps, safe production runs and tests.
DbUp runs plain SQL scripts once and journals them; FluentMigrator describes changes in C#. How each works, where each wins, and how both sit next to EF Core.
How Sqitch plans, deploys, reverts and verifies database changes with named dependencies instead of version numbers, and when it is worth the learning curve.
What schema drift is, how it creeps in through hotfixes and unsynced environments, the tools that detect it and the workflow that stops it coming back.
What to document about a database, where it should live, how to generate the parts that rot, and how to keep schema docs honest through code review and CI.
Four Go migration tools compared: file layouts, how each records applied versions, checksums, embedding in Go binaries, database support and where each fits.
ON DELETE actions explained, why PostgreSQL leaves FK columns unindexed while InnoDB indexes them, deferrable constraints and NOT VALID on big tables.
How to write Mermaid erDiagram blocks: entities, attributes with PK and FK markers, cardinality symbols, where they render, and what Mermaid cannot do.
What dotnet ef migrations add generates, how to apply migrations with database update, idempotent scripts and bundles, and surviving model snapshot conflicts.
How Alembic autogenerate compares SQLAlchemy metadata with the live database, the changes it cannot see, constraint naming conventions and SQLite batch mode.
Integer, UUID or ULID primary keys compared on size, index locality, guessability and generation, with engine specifics and a recommendation per situation.
From dbdiagram.io and DBeaver to SchemaSpy, tbls and Mermaid: what each schema visualization tool takes as input, what it produces and when to use it.
TypeORM migrations in practice: DataSource setup, generate versus create, running TypeScript migrations, migrationsRun, and why synchronize is unsafe in production.
What Django migration files contain, how dependencies and RunPython work, when to squash, how to check migrations in CI, and the traps that catch teams.
Join table design: naming, composite key or surrogate id, extra columns, indexes both ways and ON DELETE rules, with SQL, Django, Prisma and Rails examples.
Turn the schema diagram into a build artifact: regenerate it from the migrations on every change, commit it through a pull request and review the diff.
How Drizzle migrations work: drizzle-kit generate, the SQL files, snapshots and meta/_journal.json, applying them with migrate, and when to use push instead.
Liquibase accepts XML, YAML, JSON and formatted SQL changelogs. The same table in each format, how include and includeAll work, and which format fits which team.
Normalization walked through on a vet clinic spreadsheet: 1NF, 2NF, 3NF and BCNF explained in plain words, ending in the PetClinic tables, plus when to denormalize.
Three ways to turn Flyway, Liquibase, Prisma or Django migrations into an ER diagram, and a step-by-step guide to the one that always matches reality.
How five Node.js tools write, track and run database migrations, with a real migration file for each, a comparison table and advice on which one fits your project.
How Flyway names and orders migrations: the V, R and U prefixes, version separators, checksums, repair, outOfOrder and baseline, plus the mistakes that bite.
A practical naming convention for tables, columns, keys, constraints and indexes, plus the case-folding rules of PostgreSQL, Oracle, MySQL and SQL Server.
Learn to read any schema diagram: primary and composite keys, foreign keys and arrow direction, one-to-many, join tables, one-to-one and self-references.
How Prisma Migrate works: the migrations folder layout, migrate dev versus migrate deploy, the shadow database, drift detection and baselining an existing database.
A practical comparison of Flyway and Liquibase: migration model, file formats, rollback, checksums and validation, integrations, and a decision guide for teams.
SQL parsers stumble on dialects, procedural blocks, generated DDL and renames across files. Running migrations on a real engine and reading the catalog is reliable.
A plain explanation of entity-relationship diagrams: entities, attributes, relationships, cardinality, the common notations, and what belongs in one.
One HTTP call with your migration files, one poll, one SVG. Free while we build it.