Enhancement/unify migrations#249
Open
Thoni76 wants to merge 4 commits into
Open
Conversation
## Summary - Consolidated migration system from mixed Knex + node-pg-migrate to unified Knex approach - Standardized all migrations to Knex.js format (JavaScript files) - Removed duplicate migration definitions and conflicting tools ## Changes ### Migrations - Created comprehensive Knex migrations for all schema components: - invoices table with full schema and multi-tenant support - users, tenants, and api_keys for multi-tenant architecture - escrow_operations, escrow_summaries for transaction tracking - audit_log_events (append-only ledger with DB-level enforcement) - retention_policies, legal_holds, and retention audit logging - escrow event indexing tables for off-chain projection ### Configuration - Updated package.json to use only Knex migration commands - Removed duplicate \db:migrate\ script (node-pg-migrate took precedence) - All migration scripts now use: \knex migrate:latest\, \knex migrate:rollback\, etc. ### Documentation - Updated DB_MIGRATIONS.md with comprehensive Knex documentation - Added troubleshooting guides for common issues - Documented PostgreSQL-specific features (RLS, triggers) - Added production deployment best practices ### Testing - Updated migration integration tests to validate Knex migrations - Tests verify schema correctness for both SQLite and PostgreSQL - Added migration execution, rollback, and idempotency tests ### Removed - ❌ Removed node-pg-migrate configuration (migrator-config.js now unused) - ❌ Removed duplicate initial schema migrations - ❌ Removed old SQL-only migrations ## Benefits ✅ Single migration tool (Knex) - easier maintenance ✅ Supports multiple databases (SQLite dev/test, PostgreSQL prod) ✅ Better error handling and transaction support ✅ Clear separation of dev/test/prod configurations ✅ Comprehensive test coverage for migrations ## Testing - Migration structure validates correctly - All tables create successfully on fresh database - Idempotent migrations (safe to run multiple times) - Rollback capability verified Related to Liquifact#212: Unify migration tooling
|
@Thoni76 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #212