Skip to content

Release 2026.03.3 - #2041

Merged
divbzero merged 1 commit into
mainfrom
release/2026.03.3
Apr 22, 2026
Merged

Release 2026.03.3#2041
divbzero merged 1 commit into
mainfrom
release/2026.03.3

Conversation

@divbzero

Copy link
Copy Markdown
Contributor

This reapplies commit a07b0b3 (#2031).

🔗 [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"
@divbzero
divbzero requested a review from aweiland April 22, 2026 14:25
@divbzero
divbzero merged commit 871977d into main Apr 22, 2026
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.

2 participants