Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in .git-blame-ignore-revs (next commit) so git blame skips it.
26 lines
1000 B
Python
26 lines
1000 B
Python
"""notifications.created_at NOT NULL (align schema to the model)
|
|
|
|
The model has always declared `Notification.created_at: Mapped[datetime]` (NOT NULL) with
|
|
`server_default=func.now()`, but migration 0017 created the column without `nullable=False`, so the live
|
|
schema allowed NULL — a model/schema drift the new migration drift-test (E1 S2) surfaced. The
|
|
server_default has filled every row since day one, so no NULLs exist; enforcing NOT NULL just makes the
|
|
schema match the contract the model already promises. Pure DDL, reversible.
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "0066_notif_created_at_notnull"
|
|
down_revision: Union[str, None] = "0065_plex_detail_fields"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.alter_column("notifications", "created_at", nullable=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.alter_column("notifications", "created_at", nullable=True)
|