| Metadata | Value |
|---|---|
| Status | Superseded by ADR-010 |
| Version | 1.2.0 |
| Last Updated | 2026-09-10 |
| Author | Sangeetha Grantha Team |
| Document Type | Decision record |
[!NOTE] Decision record: preserve the original rationale and check its decision/supersession status. Current runtime guidance is in system architecture and Flyway migrations.
Sangita Grantha uses PostgreSQL as the primary database and requires a migration tool to manage schema evolution. The platform needed to choose between:
tools/sangita-cli) using sqlx for migrationsThe migration tool needs to:
sangita-cli)Choose Rust-based migration tool (tools/sangita-cli) using sqlx for database migrations.
Flyway is explicitly NOT used in this project.
The migration tool is implemented as part of the unified Sangita CLI (tools/sangita-cli) which also handles:
The decision was driven by several factors:
cargo run -- db migrate is simpler than Gradle + Flyway setupFlyway Rejected because:
The migration tool is part of tools/sangita-cli:
tools/sangita-cli/
├── src/
│ ├── commands/
│ │ └── db.rs # Database commands (migrate, reset, init, etc.)
│ ├── database/
│ │ └── manager.rs # DatabaseManager with migration logic
│ └── main.rs # CLI entry point
├── Cargo.toml # Rust dependencies (sqlx, clap, etc.)
└── README.md # CLI documentation
Migrations live in database/migrations/ with naming convention NN__description.sql:
01__baseline-schema-and-types.sql02__domain-tables.sql03__constraints-and-indexes.sql04__import-pipeline.sql05__sections-tags-sampradaya-temple-names.sql06__notation-tables.sql07__add-approved-import-status.sqlEach migration file follows this structure: – migrate:up SET search_path TO public;
– Migration SQL here
-- migrate:down
-- Optional rollback SQL (commented out by default)
cargo run – db migrate
cargo run – db reset
cargo run – db init
cargo run – db health
cargo run -- db start
cargo run -- db stop
| File | Purpose | Key Entities |
|---|---|---|
01__baseline-schema-and-types.sql |
Extensions, enum types, foundational tables | roles, audit_log, enums |
02__domain-tables.sql |
Primary domain tables | users, composers, ragas, talas, krithis |
03__constraints-and-indexes.sql |
Constraints, indexes, search optimization | Indexes, foreign keys |
04__import-pipeline.sql |
Data ingestion tables | import_sources, imported_krithis |
05__sections-tags-sampradaya-temple-names.sql |
Sections, tags, sampradaya | krithi_sections, tags, sampradayas |
06__notation-tables.sql |
Notation support | krithi_notation_variants, krithi_notation_rows |
07__add-approved-import-status.sql |
Import status enhancements | Import status enum updates |
✅ Completed:
🔄 In Progress:
📋 Planned:
cargo run -- db migrate)