You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 line
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)