from flask_sqlalchemy import SQLAlchemy from datetime import datetime db = SQLAlchemy() class User(db.Model): """ 用户 """ id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) name = db.Column(db.String(120)) # 身份证姓名 id_number=db.Column(db.String(20)) class Club(db.Model): """ 社团 """ id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(120), unique=True, nullable=False) description = db.Column(db.Text, nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) class Activity(db.Model): """ 社团活动 """ id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(200), nullable=False) description = db.Column(db.Text, nullable=False) type = db.Column(db.String(50)) # 活动类型 date = db.Column(db.DateTime, nullable=False) location = db.Column(db.String(200)) created_at = db.Column(db.DateTime, default=datetime.utcnow)