Spaces:
Runtime error
Runtime error
File size: 1,298 Bytes
55d0eca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | """report_template_cache: suggested report templates kept, so the Create report dialog is instant
Revision ID: 0022_report_template_cache
Revises: 0021_artifact_feedback
Create Date: 2026-10-08
"""
import sqlalchemy as sa
from alembic import op
revision = "0022_report_template_cache"
down_revision = "0021_artifact_feedback"
branch_labels = None
depends_on = None
def upgrade() -> None:
# 0001 builds from the live models, so a fresh database may already have the table.
if "report_template_cache" in sa.inspect(op.get_bind()).get_table_names():
return
op.create_table(
"report_template_cache",
sa.Column("id", sa.Uuid(), primary_key=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("workspace_id", sa.Uuid(), sa.ForeignKey("workspaces.id", ondelete="CASCADE"), nullable=False),
sa.Column("key", sa.String(64), nullable=False),
sa.Column("templates", sa.JSON(), nullable=False),
sa.UniqueConstraint("workspace_id", "key"),
)
op.create_index("ix_report_template_cache_workspace_id", "report_template_cache", ["workspace_id"])
def downgrade() -> None:
op.drop_table("report_template_cache")
|