class Question(db.Model): id = db.Column(db.Integer, primary_key=True) subject = db.Column(db.String(200), nullable=False) content = db.Column(db.Text(), nullable=False) create_date = db.Column(db.DateTime(), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='CASCADE'), nullable=False) user = db.relationship('User', backref=db.backref('question_set'))
class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(150), unique=True, nullable=False) password = db.Column(db.String(200), nullable=False) email = db.Column(db.String(120), unique=True, nullable=False)
class Chatbot(db.Model): id = db.Column(db.Integer, primary_key=True) subject = db.Column(db.String(200), nullable=False) content = db.Column(db.Text(), nullable=False) create_date = db.Column(db.DateTime(), nullable=False)
class Userinput(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.String(10), nullable=False) #아이디를 10자로 제한 content = db.Column(db.Text(), nullable=False) create_date = db.Column(db.DateTime(), nullable=False)
class Question(db.Model): id = db.Column(db.Integer, primary_key=True) # primary_key는 중복되지 않는 값임 subject = db.Column(db.String(200), nullable=False) content = db.Column(db.Text(), nullable=False) create_date = db.Column(db.DateTime(), nullable=False)