chore: seed flowpilot_cockpit feature flag with plan defaults
Disabled for free plan, enabled for pro and team. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
61
backend/alembic/versions/072_seed_flowpilot_cockpit_flag.py
Normal file
61
backend/alembic/versions/072_seed_flowpilot_cockpit_flag.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""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'")
|
||||
)
|
||||
Reference in New Issue
Block a user