from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(50), unique=True, nullable=False)
    encoding = db.Column(db.PickleType, nullable=True)  # 存储人脸特征
    photo = db.Column(db.String(255), nullable=True)


class Photo(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    created_at = db.Column(db.String(50), nullable=False)
    classification = db.Column(db.Boolean, default=False)
    classification_image_path = db.Column(db.String(255), nullable=True)