Skip to content

Conversation

@kobayurii
Copy link
Member

@kobayurii kobayurii commented Aug 15, 2025

This pull request introduces significant improvements to how database migrations are managed and documented for the NEAR Read RPC project. The changes remove migration logic from the Rust codebase and centralize migration management using SQLx CLI and dedicated scripts, with comprehensive documentation for developers and operators. This streamlines the workflow, reduces code complexity, and clarifies best practices for handling migrations across all database types.

Migration Management Refactor

  • Removed migration logic from Rust code: The read_only field and migration runner methods have been eliminated from DatabaseConfig and PostgresDBManager, so migrations are no longer handled in application code. Instead, migrations are now managed externally via scripts and SQLx CLI. [1] [2] [3] [4] [5] [6] [7]

Documentation and Developer Workflow

  • Added a comprehensive migration guide: The new docs/DATABASE_MIGRATIONS.md details the migration process, directory structure, best practices, troubleshooting, and integration with development and deployment workflows.
  • Updated database/README.md to reference the new migration documentation and legacy migration scripts for upgrading existing deployments.

Automation and Tooling

  • Introduced a migration automation script: The new scripts/apply_all_migrations.sh automates the process of applying migrations to all database types, handles environment variables, and provides clear status output and error handling.

These changes make migration management more robust, transparent, and maintainable for both new and existing deployments.

@kobayurii kobayurii requested a review from khorolets August 15, 2025 10:17
@kobayurii kobayurii self-assigned this Aug 15, 2025
@kobayurii kobayurii changed the title add docs about migration via sqlx add docs about apply migrations via sqlx Aug 15, 2025
@kobayurii kobayurii force-pushed the improvement/database_migrations branch from 875ad04 to 2afdc1c Compare August 15, 2025 11:02
@kobayurii kobayurii merged commit 65c48a5 into develop Aug 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants