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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""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("''"),
|
||||
)
|
||||
Reference in New Issue
Block a user