Repository navigation
chore(enterprise): enforce PostgreSQL-only migrations - #95
Merged
Merged
Conversation
Contributor
|
|
Contributor
simonrosenberg
marked this pull request as ready for review
July 29, 2026 12:16
simonrosenberg
commented
Jul 29, 2026
Comment on lines
+260
to
+261
| - Use SQLite in-memory databases (`sqlite:///:memory:`) for application unit tests instead of real PostgreSQL | ||
| - Do not add SQLite paths to enterprise Alembic migrations |
Member
Author
There was a problem hiding this comment.
@saurya this seems a bit annoying? prod != tests?
Contributor
There was a problem hiding this comment.
It's just too difficult to put up a whole Postgres database. SQLite serves as an adequate substitute for the purpose of quick testing.
Member
Author
|
@jlav do we really need SQLite for testing? even when its not used in prod? |
saurya
approved these changes
Jul 31, 2026
Contributor
|
🚀 Released in 1.50.0. |
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.
HUMAN:
Follow-up cleanup requested after PR #12 exposed that historical migration test scaffolding could be mistaken for supported SQLite migrations.
AGENT:
Removed unsupported migration dialect paths, added a static regression check, and validated the complete migration chain against PostgreSQL 16.
Why
The enterprise Alembic environment has always created PostgreSQL connections and acquires a PostgreSQL advisory lock. It cannot run enterprise migrations on SQLite.
Revision 115 nevertheless contained a SQLite branch solely so a unit test could execute the migration against an in-memory SQLite database. Revision 114 similarly skipped its PostgreSQL backfill on other dialects. These paths were unreachable through the supported migration runner, but they misleadingly suggested cross-database support and encouraged the same pattern to be copied into PR #12.
Summary
Issue Number
Follow-up to #12; no separate issue.
How to Test
Results: integrity check passed;
10 passed.PYTHONPATH=".:${PYTHONPATH}" poetry run --project=enterprise pytest -q \ -p no:ddtrace -p no:ddtrace.pytest_bdd -p no:ddtrace.pytest_benchmark \ enterprise/tests/unit/storage/test_jira_dc_active_link_constraint.pyResult:
7 passed.Result:
25 passed.Both the root and enterprise Python pre-commit configurations passed on every touched Python file, including Ruff, formatting, and mypy.
The full migration chain was also applied from an empty PostgreSQL 16 database with both pg8000 and psycopg2. In a separate seeded run, revision 115 reduced two active links for one user to the newest row, created the partial unique index, rejected another active link, and then upgraded successfully through revision 141.
Video/Screenshots
Not applicable; this is migration and test infrastructure cleanup.
Type
Notes
This changes historical migration source without changing supported database behavior: PostgreSQL executes the same backfill and partial index as before. Already-upgraded databases do not rerun revisions 114 or 115, while fresh installations continue to produce the same PostgreSQL schema and data state. No new Alembic revision is needed.
Application-model SQLite compatibility remains intact for ordinary unit tests.
Enterprise server image for this PR: