# @name: models.py # @version: 0.1 # @creation_date: 2021-10-20 # @license: The MIT License # @author: Simon Bowie # @purpose: Database models for tables in the database # @acknowledgements: # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login from flask_login import UserMixin from . import db from datetime import datetime # table for users class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy email = db.Column(db.String(100), unique=True) password = db.Column(db.String(100)) name = db.Column(db.String(1000)) # table for tools class Tool(db.Model): id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy created = db.Column(db.DateTime, default=datetime.utcnow) name = db.Column(db.Text) description = db.Column(db.Text)