fix: add partial index declarations to Block and Note models #263

Closed
opened 2026-04-12 17:11:37 +00:00 by forgejo_admin · 0 comments
Contributor

Type

Bug

Lineage

Regression from forgejo_admin/pal-e-api #253 — partial indexes were created in migration u1p2q3r4s5t6 but not declared in the SQLAlchemy models.

Repo

forgejo_admin/pal-e-api

What Broke

CI alembic check step fails because two partial indexes exist in the database (from migration) but are not declared in the models. Alembic interprets this as "models want these indexes removed" and reports drift:

FAILED: New upgrade operations detected: [('remove_index', Index('ix_blocks_block_type_mermaid'...)), ('remove_index', Index('ix_notes_note_type_architecture'...))]

Repro Steps

  1. Push any commit to main
  2. Woodpecker CI runs alembic check
  3. Fails with drift detection for the two partial indexes

Expected Behavior

alembic check passes — models match migrations.

Environment

  • Cluster/namespace: prod / pal-e-docs
  • Pipeline: #93 failing at alembic check step

Acceptance Criteria

  • Block.__table_args__ includes Index("ix_blocks_block_type_mermaid", "block_type", postgresql_where=text("block_type = 'mermaid'"))
  • Note.__table_args__ includes Index("ix_notes_note_type_architecture", "note_type", postgresql_where=text("note_type = 'architecture'"))
  • alembic check passes (no drift detected)
  • CI pipeline succeeds end-to-end
  • project-pal-e-platform — platform project
  • forgejo_admin/pal-e-api #253 — the PR that added the migration without model declarations
  • forgejo_admin/pal-e-api #261 — prior CI fix in this chain
### Type Bug ### Lineage Regression from `forgejo_admin/pal-e-api #253` — partial indexes were created in migration `u1p2q3r4s5t6` but not declared in the SQLAlchemy models. ### Repo `forgejo_admin/pal-e-api` ### What Broke CI `alembic check` step fails because two partial indexes exist in the database (from migration) but are not declared in the models. Alembic interprets this as "models want these indexes removed" and reports drift: ``` FAILED: New upgrade operations detected: [('remove_index', Index('ix_blocks_block_type_mermaid'...)), ('remove_index', Index('ix_notes_note_type_architecture'...))] ``` ### Repro Steps 1. Push any commit to main 2. Woodpecker CI runs `alembic check` 3. Fails with drift detection for the two partial indexes ### Expected Behavior `alembic check` passes — models match migrations. ### Environment - Cluster/namespace: prod / pal-e-docs - Pipeline: #93 failing at `alembic check` step ### Acceptance Criteria - [ ] `Block.__table_args__` includes `Index("ix_blocks_block_type_mermaid", "block_type", postgresql_where=text("block_type = 'mermaid'"))` - [ ] `Note.__table_args__` includes `Index("ix_notes_note_type_architecture", "note_type", postgresql_where=text("note_type = 'architecture'"))` - [ ] `alembic check` passes (no drift detected) - [ ] CI pipeline succeeds end-to-end ### Related - `project-pal-e-platform` — platform project - `forgejo_admin/pal-e-api #253` — the PR that added the migration without model declarations - `forgejo_admin/pal-e-api #261` — prior CI fix in this chain
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/pal-e-api#263
No description provided.