CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 59s
CI & Build / integration (push) Successful in 1m32s
CI & Build / Python tests (push) Successful in 2m33s
CI & Build / Build & push image (push) Successful in 26s
Record, milestone, phase and plan citations go from every migration header; the "end before start" fix (0043) and the suppressed-count column (0095) state the condition they prevent rather than the incident. 0053 and 0055 pointed at design specs under docs/superpowers that are not in the repo; those pointers are removed. Kept: alembic's generated "Create Date:" headers (template metadata, not rationale), 0121's ARM_BORN justification beside the constant, and 0051's illustrative "update task 42" format example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""system_usage_events — were an area's rulings read once its files were
|
|
touched?
|
|
|
|
Revision ID: 0114
|
|
Revises: 0113
|
|
Create Date: 2026-10-03
|
|
|
|
The usage twin for Systems, beside note_usage_events and rule_usage_events and
|
|
separate from both for the same reason they are separate from each other: a
|
|
System id restores through its own map. FK-free like its siblings; no CHECK on
|
|
`event`, like its siblings.
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0114"
|
|
down_revision = "0113"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"system_usage_events",
|
|
sa.Column("id", sa.BigInteger(), primary_key=True),
|
|
sa.Column(
|
|
"created_at", sa.DateTime(timezone=True), nullable=False,
|
|
server_default=sa.text("now()"),
|
|
),
|
|
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
|
sa.Column("system_id", sa.BigInteger(), nullable=False),
|
|
sa.Column("event", sa.Text(), nullable=False),
|
|
sa.Column("source", sa.Text(), nullable=False),
|
|
sa.Column("project_id", sa.BigInteger(), nullable=True),
|
|
)
|
|
op.create_index(
|
|
"ix_system_usage_system_event", "system_usage_events", ["system_id", "event"]
|
|
)
|
|
op.create_index("ix_system_usage_created_at", "system_usage_events", ["created_at"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_system_usage_created_at", table_name="system_usage_events")
|
|
op.drop_index("ix_system_usage_system_event", table_name="system_usage_events")
|
|
op.drop_table("system_usage_events")
|