Skip to content

feat(backend): add migration tracking and schema version validation#1984

Open
deepsikha-dash wants to merge 1 commit into
utksh1:mainfrom
deepsikha-dash:feature/213-alembic-style-database-migrations
Open

feat(backend): add migration tracking and schema version validation#1984
deepsikha-dash wants to merge 1 commit into
utksh1:mainfrom
deepsikha-dash:feature/213-alembic-style-database-migrations

Conversation

@deepsikha-dash

Copy link
Copy Markdown
Contributor

Description

Implemented Alembic-style migration tracking by introducing a schema migration history table and running only pending migrations during database initialization. Added validation to detect databases created with newer, unsupported migration versions and fail startup with a clear error message. Added unit tests covering migration idempotency, migration recording, and unsupported schema version detection while ensuring existing migration behavior remains unchanged.

Related Issues

Closes #213

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Executed the following test suites:

  • pytest testing/backend/unit/test_saved_views.py -v
  • pytest testing/backend/unit/test_database_connection.py -v
  • pytest testing/backend/unit/test_database_workflow_versions.py -v

Verified:

  • Pending migrations are applied only once.
  • Applied migrations are recorded.
  • Startup fails for unsupported/newer schema versions.
  • Existing database behavior remains unchanged.

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

@deepsikha-dash deepsikha-dash force-pushed the feature/213-alembic-style-database-migrations branch from bf4d390 to 67c8929 Compare July 8, 2026 17:35
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.

[BACKEND] Add Alembic-style database migrations and schema version checks

1 participant