mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 13:22:41 +02:00
Add system_prompt_slug column and migration for prompt overrides
This commit is contained in:
parent
2024e9b1ed
commit
16f4d007e4
2 changed files with 44 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
"""add system_prompt_slug to prompts
|
||||
|
||||
Revision ID: 113
|
||||
Revises: 112
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "113"
|
||||
down_revision: str | None = "112"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE prompts ADD COLUMN IF NOT EXISTS system_prompt_slug VARCHAR(100)"
|
||||
)
|
||||
op.execute(
|
||||
"CREATE INDEX IF NOT EXISTS ix_prompts_system_prompt_slug"
|
||||
" ON prompts (system_prompt_slug)"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE prompts ADD CONSTRAINT uq_prompt_user_system_slug"
|
||||
" UNIQUE (user_id, system_prompt_slug)"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE prompts DROP CONSTRAINT IF EXISTS uq_prompt_user_system_slug"
|
||||
)
|
||||
op.execute("DROP INDEX IF EXISTS ix_prompts_system_prompt_slug")
|
||||
op.execute("ALTER TABLE prompts DROP COLUMN IF EXISTS system_prompt_slug")
|
||||
Loading…
Add table
Add a link
Reference in a new issue