feat(db): 调整表结构 增加card_brand字符长度为255,新增diy_source自定义卡片品牌
This commit is contained in:
@@ -19,8 +19,14 @@ pip install -r requirements.txt
|
|||||||
- 数据库和redis连接信息
|
- 数据库和redis连接信息
|
||||||
- 图片资源上传目录
|
- 图片资源上传目录
|
||||||
- 境外代理
|
- 境外代理
|
||||||
|
-
|
||||||
|
4.迁移/更新数据库配置
|
||||||
|
|
||||||
4.启动服务
|
```shell
|
||||||
|
alembic upgrade head
|
||||||
|
```
|
||||||
|
|
||||||
|
5.启动服务
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
uvicorn main:app
|
uvicorn main:app
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def upgrade() -> None:
|
|||||||
op.create_table('system_cards',
|
op.create_table('system_cards',
|
||||||
sa.Column('cert_number', sa.String(length=50), nullable=False, comment='评级卡号'),
|
sa.Column('cert_number', sa.String(length=50), nullable=False, comment='评级卡号'),
|
||||||
sa.Column('card_year', sa.String(length=50), nullable=True, comment='卡片年份'),
|
sa.Column('card_year', sa.String(length=50), nullable=True, comment='卡片年份'),
|
||||||
sa.Column('card_brand', sa.String(length=50), nullable=True, comment='卡片品牌'),
|
sa.Column('card_brand', sa.String(length=255), nullable=True, comment='卡片品牌'),
|
||||||
sa.Column('card_score', sa.DECIMAL(precision=10, scale=1), nullable=True, comment='卡片评分'),
|
sa.Column('card_score', sa.DECIMAL(precision=10, scale=1), nullable=True, comment='卡片评分'),
|
||||||
sa.Column('auto_score', sa.DECIMAL(precision=10, scale=1), nullable=True, comment='签字评分'),
|
sa.Column('auto_score', sa.DECIMAL(precision=10, scale=1), nullable=True, comment='签字评分'),
|
||||||
sa.Column('card_name', sa.String(length=225), nullable=True, comment='卡片名称'),
|
sa.Column('card_name', sa.String(length=225), nullable=True, comment='卡片名称'),
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ session_maker = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit
|
|||||||
|
|
||||||
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
|
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
|
||||||
async with session_maker() as session:
|
async with session_maker() as session:
|
||||||
async with session.begin():
|
# async with session.begin():
|
||||||
yield session
|
yield session
|
||||||
|
|
||||||
|
|
||||||
def create_redis_pool():
|
def create_redis_pool():
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class Card(BaseModel, DateModel):
|
|||||||
|
|
||||||
cert_number: Mapped[str] = mapped_column(String(50), comment='评级卡号')
|
cert_number: Mapped[str] = mapped_column(String(50), comment='评级卡号')
|
||||||
card_year: Mapped[str] = mapped_column(String(50), nullable=True, comment='卡片年份')
|
card_year: Mapped[str] = mapped_column(String(50), nullable=True, comment='卡片年份')
|
||||||
card_brand: Mapped[str] = mapped_column(String(50), nullable=True, comment='卡片品牌')
|
card_brand: Mapped[str] = mapped_column(String(255), nullable=True, comment='卡片品牌')
|
||||||
card_score: Mapped[float] = mapped_column(DECIMAL(10, 1), nullable=True, comment='卡片评分')
|
card_score: Mapped[float] = mapped_column(DECIMAL(10, 1), nullable=True, comment='卡片评分')
|
||||||
auto_score: Mapped[float] = mapped_column(DECIMAL(10, 1), nullable=True, comment='签字评分')
|
auto_score: Mapped[float] = mapped_column(DECIMAL(10, 1), nullable=True, comment='签字评分')
|
||||||
card_name: Mapped[str] = mapped_column(String(225), nullable=True, comment='卡片名称')
|
card_name: Mapped[str] = mapped_column(String(225), nullable=True, comment='卡片名称')
|
||||||
@@ -148,6 +148,7 @@ class Card(BaseModel, DateModel):
|
|||||||
Enum(base_schema.PlatformSourceType, inherit_schema=True),
|
Enum(base_schema.PlatformSourceType, inherit_schema=True),
|
||||||
comment='来源,PSA、BGS、CGC、GBTC、CCG、BCTC :采集 、OTHER:自定义'
|
comment='来源,PSA、BGS、CGC、GBTC、CCG、BCTC :采集 、OTHER:自定义'
|
||||||
)
|
)
|
||||||
|
diy_source: Mapped[str] = mapped_column(String(50), nullable=True, comment='自定义品牌名')
|
||||||
|
|
||||||
collections: Mapped[list['UserCollection']] = relationship(
|
collections: Mapped[list['UserCollection']] = relationship(
|
||||||
back_populates='card',
|
back_populates='card',
|
||||||
|
|||||||
Reference in New Issue
Block a user