-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
29 lines (21 loc) · 931 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from sqlalchemy import Column, ForeignKey
from sqlalchemy.sql.sqltypes import DateTime, Float, String, BigInteger, Integer, Boolean
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Employee(Base):
__tablename__ = "employees"
id = Column(Integer, primary_key=True)
username = Column(String(64))
full_name = Column(String(64))
is_superuser = Column(Boolean, default=False, nullable=False)
class Chat(Base):
__tablename__ = "chats"
id = Column(BigInteger, primary_key=True)
title = Column(String(128), nullable=False)
class Reply(Base):
__tablename__ = "replies"
id = Column(Integer, primary_key=True, autoincrement=True)
time = Column(DateTime, nullable=False)
delta = Column(Float, nullable=False)
employee = Column(Integer, ForeignKey(Employee.id), nullable=False)
chat = Column(BigInteger, ForeignKey(Chat.id), nullable=False)