Polymorphes akte_notiz-Modell (gleiches entitaet_typ/entitaet_id-Muster wie Dokument/Historie/Mangel), CRUD-Endpunkte, NotizenPanel im Akte-Grid. Löschen nur durch Autor oder Administrator. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
35 lines
899 B
Python
35 lines
899 B
Python
"""FILE-009: Freitext-Notizen in der Akte.
|
|
|
|
Revision ID: 0035_akte_notiz
|
|
Revises: 0034_person
|
|
Create Date: 2026-09-10
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "0035_akte_notiz"
|
|
down_revision: Union[str, None] = "0034_person"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute(
|
|
"""
|
|
CREATE TABLE akte_notiz (
|
|
id UUID PRIMARY KEY,
|
|
entitaet_typ TEXT NOT NULL,
|
|
entitaet_id TEXT NOT NULL,
|
|
text TEXT NOT NULL,
|
|
autor_id INTEGER NOT NULL REFERENCES benutzer(id),
|
|
erstellt_am TIMESTAMPTZ NOT NULL
|
|
)
|
|
"""
|
|
)
|
|
op.execute("CREATE INDEX ix_akte_notiz_entitaet ON akte_notiz (entitaet_typ, entitaet_id)")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP TABLE akte_notiz")
|