Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

27 lines
975B

  1. # @name: models.py
  2. # @version: 0.1
  3. # @creation_date: 2021-10-20
  4. # @license: The MIT License <https://opensource.org/licenses/MIT>
  5. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  6. # @purpose: Database models for tables in the database
  7. # @acknowledgements:
  8. # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login
  9. from flask_login import UserMixin
  10. from . import db
  11. from datetime import datetime
  12. # table for users
  13. class User(UserMixin, db.Model):
  14. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  15. email = db.Column(db.String(100), unique=True)
  16. password = db.Column(db.String(100))
  17. name = db.Column(db.String(1000))
  18. # table for tools
  19. class Tool(db.Model):
  20. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  21. created = db.Column(db.DateTime, default=datetime.utcnow)
  22. name = db.Column(db.Text)
  23. description = db.Column(db.Text)