diff --git a/backend/alembic.ini b/backend/alembic.ini index f4d95fed..11849c0e 100755 --- a/backend/alembic.ini +++ b/backend/alembic.ini @@ -6,7 +6,7 @@ script_location = alembic # template used to generate migration files # file_template = %%(rev)s_%%(slug)s -file_template = %%(slug)s.py +file_template = %%(slug)s # timezone to use when rendering the date # within the migration file as well as the filename. diff --git a/backend/alembic/versions/015_modify_chat.py b/backend/alembic/versions/015_modify_chat.py new file mode 100644 index 00000000..c1c961ff --- /dev/null +++ b/backend/alembic/versions/015_modify_chat.py @@ -0,0 +1,33 @@ +"""015_modify_chat + +Revision ID: 02d84523a979 +Revises: fde8acca6143 +Create Date: 2025-06-25 15:45:14.968598 + +""" +from alembic import op +import sqlalchemy as sa +import sqlmodel.sql.sqltypes +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '02d84523a979' +down_revision = 'fde8acca6143' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('chat', 'datasource', + existing_type=sa.INTEGER(), + nullable=True) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('chat', 'datasource', + existing_type=sa.INTEGER(), + nullable=False) + # ### end Alembic commands ### diff --git a/backend/apps/chat/models/chat_model.py b/backend/apps/chat/models/chat_model.py index 43d3bea3..e5098ae7 100644 --- a/backend/apps/chat/models/chat_model.py +++ b/backend/apps/chat/models/chat_model.py @@ -18,7 +18,7 @@ class Chat(SQLModel, table=True): create_by: int = Field(sa_column=Column(BigInteger, nullable=True)) brief: str = Field(max_length=64, nullable=True) chat_type: str = Field(max_length=20, default="chat") # chat, datasource - datasource: int = Field(sa_column=Column(Integer, nullable=False)) + datasource: int = Field(sa_column=Column(Integer, nullable=True)) engine_type: str = Field(max_length=64)