From 8df69dff9ccbcc07b5bab006f90120b100bb3599 Mon Sep 17 00:00:00 2001 From: xingc Date: Fri, 9 May 2025 19:37:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=20=E5=88=A0=E9=99=A4=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E8=A1=A8action`free=5Fgift`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 ++- ...03470b2c09_del_product_action_free_gift.py | 38 +++++++++++++++++++ core/base/schema.py | 1 - core/db/models.py | 2 +- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 alembic/versions/4a03470b2c09_del_product_action_free_gift.py diff --git a/.gitignore b/.gitignore index d1d3a14..fc950eb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,7 @@ uploads **/*.zip **/*.log -**/*.py[co] \ No newline at end of file +**/*.py[co] + +.env.dev +.env.prod \ No newline at end of file diff --git a/alembic/versions/4a03470b2c09_del_product_action_free_gift.py b/alembic/versions/4a03470b2c09_del_product_action_free_gift.py new file mode 100644 index 0000000..a1d0b22 --- /dev/null +++ b/alembic/versions/4a03470b2c09_del_product_action_free_gift.py @@ -0,0 +1,38 @@ +"""del product action free_gift + +Revision ID: 4a03470b2c09 +Revises: 4a97e1258bbb +Create Date: 2025-05-09 19:35:50.208159 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision: str = '4a03470b2c09' +down_revision: Union[str, None] = '4a97e1258bbb' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('system_products', 'action', + existing_type=mysql.ENUM('VIP_RENEWAL', 'RECHARGE_POINTS', 'FREE_GIFT'), + comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points', + existing_comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points 赠送产品:free_gift', + existing_nullable=False) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('system_products', 'action', + existing_type=mysql.ENUM('VIP_RENEWAL', 'RECHARGE_POINTS', 'FREE_GIFT'), + comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points 赠送产品:free_gift', + existing_comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points', + existing_nullable=False) + # ### end Alembic commands ### diff --git a/core/base/schema.py b/core/base/schema.py index ccae32a..618616c 100644 --- a/core/base/schema.py +++ b/core/base/schema.py @@ -67,7 +67,6 @@ class ProductCategory(enum.Enum): class ProductAction(enum.Enum): VIP_RENEWAL = 'vip_renewal' RECHARGE_POINTS = 'recharge_points' - FREE_GIFT = 'free_gift' class OrderStatusType(enum.Enum): diff --git a/core/db/models.py b/core/db/models.py index f7d24f3..debcba9 100644 --- a/core/db/models.py +++ b/core/db/models.py @@ -223,7 +223,7 @@ class Product(BaseModel, DateModel): price: Mapped[int] = mapped_column(Integer, comment='价格,不带小数点 单位为分') action: Mapped[base_schema.ProductAction] = mapped_column( Enum(base_schema.ProductAction, inherit_schema=True), - comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points 赠送产品:free_gift' + comment='付款后的动作,会员续期:vip_renewal 积分:recharge_points' ) number: Mapped[int] = mapped_column(Integer, comment='执行动作的增量值') gift_id: Mapped[int] = mapped_column(Integer, nullable=True, comment='礼物产品id')