Skip to content

Commit a92b7e3

Browse files
authored
Merge pull request #44 from BUAA-SE-coders007/chore/articleDB_name_size
[chore]: 调整数据库作者名限制
2 parents 06ee84d + f64600c commit a92b7e3

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""增加作者名
2+
3+
Revision ID: a434b17f5caf
4+
Revises: 4b9d22943860
5+
Create Date: 2025-04-29 17:34:19.895192
6+
7+
"""
8+
from typing import Sequence, Union
9+
10+
from alembic import op
11+
import sqlalchemy as sa
12+
from sqlalchemy.dialects import mysql
13+
14+
# revision identifiers, used by Alembic.
15+
revision: str = 'a434b17f5caf'
16+
down_revision: Union[str, None] = '4b9d22943860'
17+
branch_labels: Union[str, Sequence[str], None] = None
18+
depends_on: Union[str, Sequence[str], None] = None
19+
20+
21+
def upgrade() -> None:
22+
"""Upgrade schema."""
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
op.alter_column('articleDB', 'author',
25+
existing_type=mysql.VARCHAR(length=100),
26+
type_=sa.String(length=300),
27+
existing_nullable=False)
28+
# ### end Alembic commands ###
29+
30+
31+
def downgrade() -> None:
32+
"""Downgrade schema."""
33+
# ### commands auto generated by Alembic - please adjust! ###
34+
op.alter_column('articleDB', 'author',
35+
existing_type=sa.String(length=300),
36+
type_=mysql.VARCHAR(length=100),
37+
existing_nullable=False)
38+
# ### end Alembic commands ###

app/models/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ArticleDB(Base):
115115

116116
title = Column(String(200), nullable=False)
117117
url = Column(String(200), nullable=False)
118-
author = Column(String(100), nullable=False)
118+
author = Column(String(300), nullable=False)
119119
file_path = Column(String(200), nullable=False)
120120

121121
create_time = Column(DateTime, default=func.now(), nullable=False) # 创建时间

0 commit comments

Comments
 (0)