20288da567
Check Cross-Plugin Imports / check (push) Has been cancelled
P34: Remove test_sample plugin from production code P35: Remove CompanyContact=None dead code from contact.py P36: Change Plugin.config from Text to JSONB (model + migration 0117 + service) P37: Add AI comment about workspace overengineering in workspace.py P38: Add container resource limits to docker-compose.yaml P39: Guest TTL 1800 not found — already migrated to regular users P40: Add AI comment about missing IP/Device binding in session.py P41: Fix Redis healthcheck to use auth password P42: RLS migration history comment already present in alembic/env.py
40 lines
898 B
Python
40 lines
898 B
Python
"""Change plugins.config column from Text to JSONB.
|
|
|
|
The config column was stored as a JSON string in a Text column.
|
|
This migration converts it to native JSONB for proper querying and validation.
|
|
|
|
Revision ID: 0117
|
|
Revises: 0116
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
|
|
revision = "0117"
|
|
down_revision = "0116"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Convert Text column to JSONB, casting existing JSON strings
|
|
op.alter_column(
|
|
"plugins",
|
|
"config",
|
|
existing_type=sa.Text(),
|
|
type_=JSONB,
|
|
postgresql_using="config::jsonb",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Convert back to Text, casting JSONB to text
|
|
op.alter_column(
|
|
"plugins",
|
|
"config",
|
|
existing_type=JSONB,
|
|
type_=sa.Text(),
|
|
postgresql_using="config::text",
|
|
)
|