""" 卡密历史记录模型 """ from sqlalchemy import Column, Integer, String, DateTime, Numeric, SmallInteger from app.database import Base class CardHis(Base): """卡密表历史记录""" __tablename__ = "cards_his" his_id = Column(Integer, primary_key=True, autoincrement=True, comment="历史记录主键ID") id = Column(Integer, nullable=False, comment="原表主键ID") card_code = Column(String(32), nullable=False, comment="卡密代码") software_code = Column(String(50), nullable=False, comment="软件特征码") days = Column(Integer, nullable=False, comment="天数") discount = Column(Numeric(5, 2), default=1.00, comment="折扣") user_id = Column(Integer, comment="激活用户ID") activated_at = Column(DateTime, comment="激活时间") expire_time = Column(DateTime, comment="到期时间") status = Column(SmallInteger, default=0, comment="状态:0-未激活,1-已激活,2-已过期") is_deleted = Column(SmallInteger, default=0, comment="是否删除:0-否,1-是") created_at = Column(DateTime, comment="创建时间") updated_at = Column(DateTime, comment="更新时间") his_created_at = Column(DateTime, comment="历史记录创建时间") his_operation = Column(String(10), nullable=False, comment="操作类型:INSERT/UPDATE/DELETE")