Skip to content

Commit 7fa8450

Browse files
committed
feat: modify chat
1 parent 72b6e11 commit 7fa8450

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

backend/alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ script_location = alembic
66

77
# template used to generate migration files
88
# file_template = %%(rev)s_%%(slug)s
9-
file_template = %%(slug)s.py
9+
file_template = %%(slug)s
1010

1111
# timezone to use when rendering the date
1212
# within the migration file as well as the filename.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""015_modify_chat
2+
3+
Revision ID: 02d84523a979
4+
Revises: fde8acca6143
5+
Create Date: 2025-06-25 15:45:14.968598
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlmodel.sql.sqltypes
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '02d84523a979'
15+
down_revision = 'fde8acca6143'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.alter_column('chat', 'datasource',
23+
existing_type=sa.INTEGER(),
24+
nullable=True)
25+
# ### end Alembic commands ###
26+
27+
28+
def downgrade():
29+
# ### commands auto generated by Alembic - please adjust! ###
30+
op.alter_column('chat', 'datasource',
31+
existing_type=sa.INTEGER(),
32+
nullable=False)
33+
# ### end Alembic commands ###

backend/apps/chat/models/chat_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Chat(SQLModel, table=True):
1818
create_by: int = Field(sa_column=Column(BigInteger, nullable=True))
1919
brief: str = Field(max_length=64, nullable=True)
2020
chat_type: str = Field(max_length=20, default="chat") # chat, datasource
21-
datasource: int = Field(sa_column=Column(Integer, nullable=False))
21+
datasource: int = Field(sa_column=Column(Integer, nullable=True))
2222
engine_type: str = Field(max_length=64)
2323

2424

0 commit comments

Comments
 (0)