Files
flyer-crawler.projectium.com/docs/adr/0023-database-schema-migration-strategy.md
Torben Sorensen 8b06a66b17
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled
testing ADR - architectural decisions
2025-12-12 00:01:35 -08:00

18 lines
1.0 KiB
Markdown

# ADR-023: Database Schema Migration Strategy
**Date**: 2025-12-12
**Status**: Proposed
## Context
The `README.md` indicates that the database schema is managed by manually running a large `schema.sql.txt` file. This approach is highly error-prone, makes tracking changes difficult, 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`**. All future schema changes (e.g., `ALTER TABLE`, `CREATE INDEX`) will be written as individual, version-controlled, timestamped migration scripts that can be applied and rolled back automatically.
## 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.