29 lines
775 B
Python
29 lines
775 B
Python
"""Persist the documented knowledge-space data policy."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0004_space_data_policy"
|
|
down_revision = "0003_identity_credentials"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Add an explicit policy column with the contract's local-only default."""
|
|
|
|
op.add_column(
|
|
"spaces",
|
|
sa.Column("data_policy", sa.String(32), nullable=False, server_default="local_only"),
|
|
schema="control",
|
|
)
|
|
op.alter_column("spaces", "data_policy", server_default=None, schema="control")
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Remove only the policy column introduced by this migration."""
|
|
|
|
op.drop_column("spaces", "data_policy", schema="control")
|