Release 2026.03.3 - #2041
Merged
Merged
Conversation
🔗 [Jira Ticket M2-9695](https://mindlogger.atlassian.net/browse/M2-9695) 🔗 [Jira Ticket M2-10487](https://mindlogger.atlassian.net/browse/M2-10487) We’ve accumulated a number of SQLAlchemy schema changes that aren’t reflected in the Alembic migrations and vice versa, so `uv run alembic revision --autogenerate` hasn’t been working cleanly. The following changes bring SQLAlchemy schemas and Alembic migrations back in sync. The PRs when schema and migration deviated are included for reference. Add SQLAlchemy schemas missing in Alembic’s list of `migrations_apps`: - `apps.activity_assignments.db.schemas` #1511 - `apps.integrations.loris.db.schemas` #1580 Update SQLAlchemy schemas to match Alembic migrations: - `Text()` → `String()` for `answers.{applet,activity,flow}_history_id` #518 - `String(56)` → `String(100)` for `users.email` #528 - `name="token_purpose"` for `token_blacklist.type` enum #551 - `String(5)` → `String(20)` for `subjects.language` #1217 - `ForeignKey` → `UUID` for `activity_assignments.{activity_id,activity_flow_id}` #1533 - `nullable=False` for `event_histories.{version,periodicity}` #1718 - `nullable=False` for `events.{version,periodicity}` #1733 - `index=False` for `answers.{event_history_id,device_id}` #1754 - `Index(postgresql_using="gin")` for `subjects.meta` #1798 - `onupdate="CASCADE"` for `{subjects,events}.id` foreign keys #1802 - `UniqueConstraint` for `answers_ehr (submit_id, activity_id)` #1837 - `nullable=False` for `subjects.is_deleted` #1855 - `nullable=False` for `users.mfa_enabled` #1973 Add missing `token_blacklist.type` enum values: - `MFA = "mfa"` #1976 - `DOWNLOAD_RECOVERY_CODES = "download_recovery_codes"` #1983 Drop tables and columns left over from schedule migration: - `{activity,flow,user}_events` tables #1723 - `periodicity` table and `events.periodicity_id` column #1733 - `subjects.is_deleted_null` column #1855 - `applet_events_cleanup` table #1858 Drop redundant `(submit_id, activity_id)` composite index: - Already indexed by `answers_ehr_submit_activity_key` unique constraint #1837 Create missing `consents` table: - Defined for LORIS integration but never created #1580 After the changes, test autogenerate yields an empty migration: uv run alembic upgrade head uv run alembic revision --autogenerate -m "Test autogenerate migration"
aweiland
approved these changes
Apr 22, 2026
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.
This reapplies commit a07b0b3 (#2031).