text: from extensions import db
  from datetime import datetime
  from werkzeug.security import generate_password_hash,check_password_hash
  
  
  class User(db.Model):
      __tablename__ = 'user'
  
      id = db.Column(db.Integer, primary_key=True, autoincrement=True)
      telephone = db.Column(db.String(11), nullable=False)
      username = db.Column(db.String(50), nullable=False)
      password = db.Column(db.String(100), nullable=False)
  
      def __init__(self,*args, **kwargs):
          self.telephone = kwargs.get("telephone")
          self.username = kwargs.get("username")
          self.password =  generate_password_hash(kwargs.get("password"))
  
      def check_password(self,raw_password):
          return check_password_hash(self.password,raw_password)
  
  class Question(db.Model):
      __tablename__ = 'question'
  
      id = db.Column(db.Integer, primary_key=True, autoincrement=True)
      title = db.Column(db.String(100), nullable=False)
      content = db.Column(db.Text, nullable=False)
      createtime = db.Column(db.DateTime, default=datetime.now)
  
      author_id = db.Column(db.Integer, db.ForeignKey("user.id"),nullable=False)
  
      author = db.relationship('User', backref=db.backref('questions'))
  
  
  class Answer(db.Model):
      __tablename__ = 'answer'
  
      id = db.Column(db.Integer,primary_key=True,autoincrement=True)
      content = db.Column(db.Text, nullable=False)
      createtime = db.Column(db.DateTime, default=datetime.now)
  
      question_id = db.Column(db.Integer, db.ForeignKey("question.id"), nullable=False)
      author_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
  
      question = db.relationship('Question',backref = db.backref('answers'))
      author = db.relationship('User', backref=db.backref('answers'))