Add user table
This commit is contained in:
parent
6028ecf5d3
commit
09b4b47b8d
|
@ -1,7 +1,7 @@
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from .database import session, now_utc
|
from .database import session, now_utc
|
||||||
from sqlalchemy.schema import Column, ForeignKey
|
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.orm import column_property, relationship, synonym
|
||||||
from sqlalchemy.ext.associationproxy import association_proxy
|
from sqlalchemy.ext.associationproxy import association_proxy
|
||||||
from sqlalchemy.sql.expression import cast
|
from sqlalchemy.sql.expression import cast
|
||||||
|
@ -11,6 +11,14 @@ from urllib.parse import quote
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
Base.query = session.query_property()
|
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):
|
class DepictsItem(Base):
|
||||||
__tablename__ = 'depicts'
|
__tablename__ = 'depicts'
|
||||||
item_id = Column(Integer, primary_key=True, autoincrement=False)
|
item_id = Column(Integer, primary_key=True, autoincrement=False)
|
||||||
|
|
Loading…
Reference in a new issue