選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

63 行
2.1KB

  1. # @name: models.py
  2. # @creation_date: 2021-10-20
  3. # @license: The MIT License <https://opensource.org/licenses/MIT>
  4. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  5. # @purpose: Database models for tables in the database
  6. # @acknowledgements:
  7. # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login
  8. from flask_login import UserMixin
  9. from . import db
  10. from datetime import datetime
  11. # table for users
  12. class User(UserMixin, db.Model):
  13. __tablename__ = 'User'
  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(1000))
  17. name = db.Column(db.String(1000))
  18. # table for resources
  19. class Resource(db.Model):
  20. __tablename__ = 'Resource'
  21. # all resource types
  22. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  23. created = db.Column(db.DateTime, default=datetime.utcnow)
  24. type = db.Column(db.Text)
  25. name = db.Column(db.Text)
  26. description = db.Column(db.Text)
  27. # tools
  28. developer = db.Column(db.Text)
  29. developerUrl = db.Column(db.Text)
  30. projectUrl = db.Column(db.Text)
  31. repositoryUrl = db.Column(db.Text)
  32. license = db.Column(db.Text)
  33. scriptingLanguage = db.Column(db.Text)
  34. expertiseToUse = db.Column(db.Text)
  35. expertiseToHost = db.Column(db.Text)
  36. dependencies = db.Column(db.Text)
  37. ingestFormats = db.Column(db.Text)
  38. outputFormats = db.Column(db.Text)
  39. status = db.Column(db.Text)
  40. # practices
  41. longDescription = db.Column(db.Text)
  42. experimental = db.Column(db.Text)
  43. considerations = db.Column(db.Text)
  44. references = db.Column(db.Text)
  45. # books
  46. author = db.Column(db.Text)
  47. year = db.Column(db.Text)
  48. bookUrl = db.Column(db.Text)
  49. isbn = db.Column(db.Text)
  50. typology = db.Column(db.Text)
  51. # table for relationships
  52. class Relationship(db.Model):
  53. __tablename__ = 'Relationship'
  54. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  55. first_resource_id = db.Column(db.Integer)
  56. second_resource_id = db.Column(db.Integer)