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.

50 line
1.8KB

  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)
  24. project_url = db.Column(db.Text)
  25. repository_url = db.Column(db.Text)
  26. platform_status = db.Column(db.Text)
  27. expertise = db.Column(db.Text)
  28. self_host_expertise = db.Column(db.Text)
  29. ingest = db.Column(db.Text)
  30. output = db.Column(db.Text)
  31. saas = db.Column(db.Text)
  32. dependencies = db.Column(db.Text)
  33. # table for books
  34. class Book(db.Model):
  35. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  36. created = db.Column(db.DateTime, default=datetime.utcnow)
  37. name = db.Column(db.Text)
  38. description = db.Column(db.Text)
  39. # table for examples
  40. class Practice(db.Model):
  41. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  42. created = db.Column(db.DateTime, default=datetime.utcnow)
  43. name = db.Column(db.Text)
  44. description = db.Column(db.Text)