From 09b4b47b8dc9e50eee6bde2fb620dad1f353780b Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 7 Nov 2019 10:12:56 +0000 Subject: [PATCH] Add user table --- depicts/model.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/depicts/model.py b/depicts/model.py index 6d7a51b..12e4fc0 100644 --- a/depicts/model.py +++ b/depicts/model.py @@ -1,7 +1,7 @@ from sqlalchemy.ext.declarative import declarative_base from .database import session, now_utc from sqlalchemy.schema import Column, ForeignKey -from sqlalchemy.types import Integer, String, DateTime +from sqlalchemy.types import Integer, String, DateTime, Boolean from sqlalchemy.orm import column_property, relationship, synonym from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.sql.expression import cast @@ -11,6 +11,14 @@ from urllib.parse import quote Base = declarative_base() Base.query = session.query_property() +class User(Base): + __tablename__ = 'user' + id = Column(Integer, primary_key=True, autoincrement=False) + username = Column(String, unique=True) + options = Column(postgresql.JSON) + first_seen = Column(DateTime, default=now_utc()) + is_admin = Column(Boolean, default=False) + class DepictsItem(Base): __tablename__ = 'depicts' item_id = Column(Integer, primary_key=True, autoincrement=False)