2019-10-06 01:49:30 +02:00
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
from sqlalchemy import Column, Integer, Boolean, BigInteger, JSON
|
|
|
|
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
|
|
|
|
|
|
class Poll(Base):
|
|
|
|
__tablename__ = 'polls'
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=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-06 23:49:00 +02:00
|
|
|
content = Column(JSON)
|
2019-10-06 01:49:30 +02:00
|
|
|
is_anonymous = Column(Boolean)
|
|
|
|
responses = Column(JSON, nullable=True)
|
|
|
|
|
|
|
|
def __repr__(self):
|
2019-10-06 23:49:00 +02:00
|
|
|
return "<Poll(id='%s', channel_id='%s', message_id='%s', poll='%s', " \
|
2019-10-06 01:49:30 +02:00
|
|
|
"is_anonymous='%s', responses='%s')>" % \
|
2019-10-06 23:49:00 +02:00
|
|
|
(self.id, self.channel_id, self.message_id, self.content,
|
2019-10-06 01:49:30 +02:00
|
|
|
self.is_anonymous, self.responses)
|