Files
ai-video-fullstack/backend/migrations/versions/20260807_0014_assistant_prompt_to_text.py
Xin Wang 39ee5ef96e refactor(backend): change prompt field type from varchar(8192) to text
Update the 'prompt' field in the Assistant model to use a Text type for improved flexibility. This change is accompanied by a migration script to alter the database schema accordingly.
2026-08-07 11:30:58 +08:00

41 lines
909 B
Python

"""change assistants.prompt from varchar(8192) to text
Revision ID: 20260807_0014
Revises: 20260807_0013
"""
from __future__ import annotations
from collections.abc import Sequence
from alembic import op
import sqlalchemy as sa
revision: str = "20260807_0014"
down_revision: str | Sequence[str] | None = "20260807_0013"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.alter_column(
"assistants",
"prompt",
existing_type=sa.String(length=8192),
type_=sa.Text(),
existing_nullable=False,
existing_server_default=sa.text("''"),
)
def downgrade() -> None:
op.alter_column(
"assistants",
"prompt",
existing_type=sa.Text(),
type_=sa.String(length=8192),
existing_nullable=False,
existing_server_default=sa.text("''"),
)