Some checks failed
Flutter Windows / verify-windows (push) Has been cancelled
Gate external ChatGPT/Claude connections behind ai_mcp_server while keeping the session alive so the assistant can tell the user the plugin is inactive or expired. In-app chat and REST APIs stay free. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
"""Seed افزونه سرور MCP هوش مصنوعی در بازار.
|
|
|
|
Revision ID: 20261104_000003_ai_mcp_server_plugin
|
|
Revises: 20261104_000002_advanced_accounting_plugin
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from adapters.db.seed_data.marketplace_plugins_seed import ensure_default_marketplace_plugins
|
|
|
|
revision = "20261104_000003_ai_mcp_server_plugin"
|
|
down_revision = "20261104_000002_advanced_accounting_plugin"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
conn = op.get_bind()
|
|
insp = sa.inspect(conn)
|
|
if "marketplace_plugins" not in insp.get_table_names():
|
|
return
|
|
|
|
Session = sessionmaker(bind=conn)
|
|
db = Session()
|
|
try:
|
|
result = ensure_default_marketplace_plugins(db)
|
|
if result.get("ok"):
|
|
db.commit()
|
|
else:
|
|
db.rollback()
|
|
raise RuntimeError(result.get("message") or "marketplace_plugins seed failed")
|
|
except Exception:
|
|
db.rollback()
|
|
raise
|
|
finally:
|
|
db.close()
|
|
|
|
|
|
def downgrade() -> None:
|
|
# حذف خودکار ردیف بازار خطرناک است (سفارش/لایسنس).
|
|
pass
|