Files
flyer-crawler.projectium.com/docs/adr/0013-database-schema-migration-strategy.md
Torben Sorensen 45ac4fccf5
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 2m15s
comprehensive documentation review + test fixes
2026-01-28 16:35:38 -08:00

1.1 KiB

ADR-013: Database Schema Migration Strategy

Date: 2025-12-12

Status: Superseded by ADR-023

Note: This ADR was an early draft. ADR-023 provides a more detailed specification for the same topic.

Context

The current database schema is managed by manually running a large schema.sql.txt file. This approach is highly error-prone, makes it difficult to track changes, and is not feasible for updating a live production database without downtime or data loss.

Decision

We will adopt a dedicated database migration tool, such as node-pg-migrate or Knex.js. All future schema changes (e.g., adding a column, creating a table) will be written as individual, version-controlled migration scripts.

Consequences

  • Positive: Provides a safe, repeatable, and reversible way to evolve the database schema. Improves team collaboration on database changes. Reduces the risk of data loss or downtime during deployments.
  • Negative: Requires an initial setup and learning curve for the chosen migration tool. All future schema changes must adhere to the migration workflow.