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

Merged
forgejo_admin merged 1 commit from 263-fix-add-partial-index-declarations-to-bl into main 2026-04-12 17:20:23 +00:00
Contributor

Summary

Adds missing partial index declarations to the Block and Note SQLAlchemy models so they match the indexes already present in the database (created by migration u1p2q3r4s5t6). This resolves alembic check drift detection that was failing CI.

Changes

  • src/pal_e_docs/models.py: Added text to sqlalchemy imports
  • src/pal_e_docs/models.py: Added __table_args__ to Note class with ix_notes_note_type_architecture partial index
  • src/pal_e_docs/models.py: Added ix_blocks_block_type_mermaid partial index to Block __table_args__

Test Plan

  • ruff check and ruff format --check pass
  • from pal_e_docs.models import Block, Note imports successfully
  • alembic check should no longer detect drift for these indexes

Review Checklist

  • ruff check passes
  • ruff format passes
  • Models import without error
  • Index names match existing DB indexes from migration u1p2q3r4s5t6
  • No pal-e-docs notes affected

Closes #263

## Summary Adds missing partial index declarations to the Block and Note SQLAlchemy models so they match the indexes already present in the database (created by migration u1p2q3r4s5t6). This resolves `alembic check` drift detection that was failing CI. ## Changes - `src/pal_e_docs/models.py`: Added `text` to sqlalchemy imports - `src/pal_e_docs/models.py`: Added `__table_args__` to Note class with `ix_notes_note_type_architecture` partial index - `src/pal_e_docs/models.py`: Added `ix_blocks_block_type_mermaid` partial index to Block `__table_args__` ## Test Plan - `ruff check` and `ruff format --check` pass - `from pal_e_docs.models import Block, Note` imports successfully - `alembic check` should no longer detect drift for these indexes ## Review Checklist - [x] ruff check passes - [x] ruff format passes - [x] Models import without error - [x] Index names match existing DB indexes from migration u1p2q3r4s5t6 ## Related Notes - No pal-e-docs notes affected ## Related Closes #263
Closes #263

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Contributor

QA Review -- PR #264

Summary

Single-file change (13 additions, 0 deletions) to src/pal_e_docs/models.py. Adds two partial index declarations to SQLAlchemy models that match existing database indexes from migration u1p2q3r4s5t6.

Findings

Code quality: PASS

  • text import added correctly to the existing sqlalchemy import block
  • ix_notes_note_type_architecture partial index added to Note.__table_args__ with correct postgresql_where clause
  • ix_blocks_block_type_mermaid partial index added to Block.__table_args__ with correct postgresql_where clause
  • Index names match the migration-created indexes exactly
  • Placement within __table_args__ tuples is correct (trailing comma preserved, UniqueConstraint stays last in Block)

Linting: PASS

  • ruff check passes
  • ruff format --check passes

Import verification: PASS

  • from pal_e_docs.models import Block, Note succeeds

SOP compliance: PASS

  • Branch naming follows {issue-number}-{kebab-case} convention
  • PR body includes all required sections (Summary, Changes, Test Plan, Review Checklist, Related Notes, Related)
  • Closes #263 present for auto-close

No issues found

This is a minimal, correct fix that brings the ORM model declarations into alignment with the existing database schema.


VERDICT: APPROVED

## QA Review -- PR #264 ### Summary Single-file change (13 additions, 0 deletions) to `src/pal_e_docs/models.py`. Adds two partial index declarations to SQLAlchemy models that match existing database indexes from migration `u1p2q3r4s5t6`. ### Findings **Code quality: PASS** - `text` import added correctly to the existing sqlalchemy import block - `ix_notes_note_type_architecture` partial index added to `Note.__table_args__` with correct `postgresql_where` clause - `ix_blocks_block_type_mermaid` partial index added to `Block.__table_args__` with correct `postgresql_where` clause - Index names match the migration-created indexes exactly - Placement within `__table_args__` tuples is correct (trailing comma preserved, UniqueConstraint stays last in Block) **Linting: PASS** - `ruff check` passes - `ruff format --check` passes **Import verification: PASS** - `from pal_e_docs.models import Block, Note` succeeds **SOP compliance: PASS** - Branch naming follows `{issue-number}-{kebab-case}` convention - PR body includes all required sections (Summary, Changes, Test Plan, Review Checklist, Related Notes, Related) - `Closes #263` present for auto-close ### No issues found This is a minimal, correct fix that brings the ORM model declarations into alignment with the existing database schema. --- **VERDICT: APPROVED**
forgejo_admin deleted branch 263-fix-add-partial-index-declarations-to-bl 2026-04-12 17:20:23 +00:00
Commenting is not possible because the repository is archived.
No description provided.