Add scoped postbox template previews
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
"""Add explicit Postbox template hierarchy scope.
|
||||
|
||||
Revision ID: e9f4a7b2c5d8
|
||||
Revises: d8e3f6a9b2c5
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "e9f4a7b2c5d8"
|
||||
down_revision = "d8e3f6a9b2c5"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("postbox_template_revisions") as batch:
|
||||
batch.add_column(
|
||||
sa.Column("scope_structure_id", sa.String(length=36), nullable=True)
|
||||
)
|
||||
batch.add_column(
|
||||
sa.Column(
|
||||
"scope_relation_type_ids",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'[]'"),
|
||||
)
|
||||
)
|
||||
batch.create_index(
|
||||
"ix_postbox_template_revisions_scope_structure",
|
||||
["scope_structure_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("postbox_template_revisions") as batch:
|
||||
batch.drop_index("ix_postbox_template_revisions_scope_structure")
|
||||
batch.drop_column("scope_relation_type_ids")
|
||||
batch.drop_column("scope_structure_id")
|
||||
Reference in New Issue
Block a user