feat: add language column, AI Generated category, and mine/shared filters
- Add language column (powershell/bash/python) to script_templates model and schemas - Seed 'AI Generated' script category via migration 063 - Add mine and shared query params to list_templates endpoint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""add_language_to_script_templates_and_ai_generated_category
|
||||
|
||||
Revision ID: 063
|
||||
Revises: 062
|
||||
Create Date: 2026-03-21 21:13:32.239533
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '063'
|
||||
down_revision: Union[str, None] = '062'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add language column to script_templates
|
||||
op.add_column(
|
||||
'script_templates',
|
||||
sa.Column(
|
||||
'language',
|
||||
sa.String(length=30),
|
||||
nullable=True,
|
||||
comment='Script language: powershell, bash, python',
|
||||
),
|
||||
)
|
||||
|
||||
# Seed "AI Generated" category
|
||||
op.execute(
|
||||
sa.text("""
|
||||
INSERT INTO script_categories (id, name, slug, description, icon, sort_order, is_active, created_at, updated_at)
|
||||
VALUES (
|
||||
'a0000000-0000-0000-0000-000000000001'::uuid,
|
||||
'AI Generated',
|
||||
'ai-generated',
|
||||
'Scripts generated by the AI Script Builder',
|
||||
'sparkles',
|
||||
100,
|
||||
true,
|
||||
NOW(),
|
||||
NOW()
|
||||
)
|
||||
ON CONFLICT (slug) DO NOTHING
|
||||
""")
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(sa.text("DELETE FROM script_categories WHERE slug = 'ai-generated'"))
|
||||
op.drop_column('script_templates', 'language')
|
||||
Reference in New Issue
Block a user