- Add DockingEvent model with parent/child asset relations, docked_at/undocked_at timestamps - Add docking migration for new docking_events table - Add .ad-dock, .ad-dock-box, .ad-dock-item, .ad-undock CSS classes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
2.0 KiB
Python
47 lines
2.0 KiB
Python
"""add docking events
|
|
|
|
Revision ID: 2a4c9d8e7f10
|
|
Revises: 8bbf69ea2013
|
|
Create Date: 2026-05-31 19:30:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "2a4c9d8e7f10"
|
|
down_revision = "8bbf69ea2013"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
"docking_events",
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
sa.Column("parent_asset_id", sa.Uuid(), nullable=False),
|
|
sa.Column("child_asset_id", sa.Uuid(), nullable=True),
|
|
sa.Column("child_label", sa.String(length=255), nullable=True),
|
|
sa.Column("docked_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("undocked_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("dock_note", sa.Text(), nullable=True),
|
|
sa.Column("undock_note", sa.Text(), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.ForeignKeyConstraint(["child_asset_id"], ["assets.id"], ondelete="SET NULL"),
|
|
sa.ForeignKeyConstraint(["parent_asset_id"], ["assets.id"], ondelete="CASCADE"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_docking_events_child_asset_id"), "docking_events", ["child_asset_id"], unique=False)
|
|
op.create_index(op.f("ix_docking_events_docked_at"), "docking_events", ["docked_at"], unique=False)
|
|
op.create_index(op.f("ix_docking_events_parent_asset_id"), "docking_events", ["parent_asset_id"], unique=False)
|
|
op.create_index(op.f("ix_docking_events_undocked_at"), "docking_events", ["undocked_at"], unique=False)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(op.f("ix_docking_events_undocked_at"), table_name="docking_events")
|
|
op.drop_index(op.f("ix_docking_events_parent_asset_id"), table_name="docking_events")
|
|
op.drop_index(op.f("ix_docking_events_docked_at"), table_name="docking_events")
|
|
op.drop_index(op.f("ix_docking_events_child_asset_id"), table_name="docking_events")
|
|
op.drop_table("docking_events")
|