16 lines
672 B
Python
16 lines
672 B
Python
from sqlalchemy import Column, Integer, String, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.database import Base
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
|
|
openid = Column(String(50), unique=True, index=True)
|
|
unionid = Column(String(50), nullable=True, index=True)
|
|
avatar = Column(String(255), nullable=True, comment="头像")
|
|
nickname = Column(String(50), nullable=True, comment="昵称")
|
|
create_time = Column(DateTime, default=func.now(), comment="创建时间")
|
|
|
|
def __repr__(self):
|
|
return f"<User(id={self.id}, nickname={self.nickname})>" |