Disabled for free plan, enabled for pro and team. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
1.9 KiB
Python
62 lines
1.9 KiB
Python
"""Seed flowpilot_cockpit feature flag with plan defaults.
|
|
|
|
Revision ID: 072
|
|
Revises: 071
|
|
Create Date: 2026-04-02
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "072"
|
|
down_revision = "071"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Insert the feature flag
|
|
op.execute(
|
|
sa.text(
|
|
"INSERT INTO feature_flags (id, flag_key, display_name, description) "
|
|
"VALUES (gen_random_uuid(), 'flowpilot_cockpit', 'FlowPilot Cockpit', "
|
|
"'Access to the FlowPilot Cockpit triage view') "
|
|
"ON CONFLICT (flag_key) DO NOTHING"
|
|
)
|
|
)
|
|
|
|
# Set plan defaults: disabled for free, enabled for pro and team
|
|
op.execute(
|
|
sa.text(
|
|
"INSERT INTO plan_feature_defaults (id, plan, flag_id, enabled) "
|
|
"SELECT gen_random_uuid(), 'free', id, false FROM feature_flags WHERE flag_key = 'flowpilot_cockpit' "
|
|
"ON CONFLICT (plan, flag_id) DO NOTHING"
|
|
)
|
|
)
|
|
op.execute(
|
|
sa.text(
|
|
"INSERT INTO plan_feature_defaults (id, plan, flag_id, enabled) "
|
|
"SELECT gen_random_uuid(), 'pro', id, true FROM feature_flags WHERE flag_key = 'flowpilot_cockpit' "
|
|
"ON CONFLICT (plan, flag_id) DO NOTHING"
|
|
)
|
|
)
|
|
op.execute(
|
|
sa.text(
|
|
"INSERT INTO plan_feature_defaults (id, plan, flag_id, enabled) "
|
|
"SELECT gen_random_uuid(), 'team', id, true FROM feature_flags WHERE flag_key = 'flowpilot_cockpit' "
|
|
"ON CONFLICT (plan, flag_id) DO NOTHING"
|
|
)
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute(
|
|
sa.text(
|
|
"DELETE FROM plan_feature_defaults WHERE flag_id IN "
|
|
"(SELECT id FROM feature_flags WHERE flag_key = 'flowpilot_cockpit')"
|
|
)
|
|
)
|
|
op.execute(
|
|
sa.text("DELETE FROM feature_flags WHERE flag_key = 'flowpilot_cockpit'")
|
|
)
|