test: add PostgreSQL schema smoke tests (#613)#916
Open
antharya05 wants to merge 1 commit into
Open
Conversation
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.
Description
This PR adds PostgreSQL-backed schema smoke tests to CI to validate database schema creation and common database operations against the same database engine used in production.
After auditing the repository, I found that the project currently manages schema creation through SQLAlchemy's
Base.metadata.create_all()and does not use a migration framework such as Alembic or Prisma. Existing backend tests primarily run against SQLite, while production uses PostgreSQL 16.This creates a gap where schema or constraint issues may pass CI but fail after deployment.
Changes made
Added a dedicated GitHub Actions workflow:
.github/workflows/schema-tests.ymlAdded PostgreSQL schema smoke tests:
backend/tests/test_schema_smoke.pyConfigured a PostgreSQL 16 service container in CI
Validated:
Base.metadata.create_all()Why this change
The existing test suite validates database functionality using SQLite. Production deployments run on PostgreSQL 16, which may enforce constraints and schema rules differently.
These smoke tests help catch schema-related issues before deployment and reduce the risk of production database failures.
Related Issue
Fixes #613
Type of change
Checklist
mainpytest -vand all tests passfeat/fix/docs/test: short descriptionScreenshots (if frontend change)
N/A
Test evidence