2019-10-06 01:49:30 +02:00
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
2019-10-09 00:14:43 +02:00
|
|
|
from sqlalchemy import Column, Integer, Text, BigInteger, JSON, ForeignKey
|
|
|
|
from sqlalchemy.orm import relationship
|
2019-10-06 01:49:30 +02:00
|
|
|
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
|
|
|
|
|
|
class Poll(Base):
|
|
|
|
__tablename__ = 'polls'
|
|
|
|
|
2019-10-09 00:14:43 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2019-10-06 23:49:00 +02:00
|
|
|
channel_id = Column(BigInteger)
|
2019-10-06 01:49:30 +02:00
|
|
|
message_id = Column(BigInteger)
|
2019-10-09 00:14:43 +02:00
|
|
|
|
2019-10-06 23:49:00 +02:00
|
|
|
content = Column(JSON)
|
2019-10-09 00:14:43 +02:00
|
|
|
|
|
|
|
choice = relationship("Responses")
|
|
|
|
|
|
|
|
|
|
|
|
class Responses(Base):
|
|
|
|
__tablename__ = 'responses'
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
user = Column(Text)
|
|
|
|
|
|
|
|
poll_id = Column(Integer, ForeignKey('polls.id'))
|
|
|
|
choice = Column(Integer)
|