Last active
December 21, 2015 04:39
-
-
Save kotfic/6250839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Base = declarative_base() | |
wtp_data_petition_responses = Table('wtp_data_petition_responses', Base.metadata, | |
Column('petition_id', String(64)), | |
Column('response_id', String(64)), | |
Column('association_time', Integer(11))) | |
class Response(Base): | |
__tablename__ = 'wtp_data_responses' | |
id = Column(String(64), primary_key=True) | |
url = Column(String(256)) | |
petitions = relationship("Petition", | |
secondary=wtp_data_petition_responses, | |
backref=backref("wtp_data_responses")) | |
def __init__(self, id, url): | |
self.id = id | |
self.url = url | |
def __repr__(self): | |
return "<Response( '%s', '%s' )>" % (self.id, self.url) | |
class Petition(Base): | |
__tablename__ = 'wtp_data_petitions' | |
status_types = [u'open', u'responded', u'closed', u'pending response'] | |
serial = Column(Integer(11), primary_key=True) | |
id = Column(String(64)) | |
type = Column(String(32)) | |
title = Column(String(128)) | |
body = Column(Text) | |
signature_threshold = Column(Integer(11)) | |
signature_count = Column(Integer(11)) | |
signatures_needed = Column(Integer(11)) | |
url = Column(String(512)) | |
deadline = Column(Integer(11)) | |
status = Column(String(32)) | |
created = Column(Integer(11)) | |
MariaDB [whpet_dump]> describe wtp_data_petitions; | |
+---------------------+--------------+------+-----+---------+----------------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+---------------------+--------------+------+-----+---------+----------------+ | |
| serial | int(11) | NO | PRI | NULL | auto_increment | | |
| id | varchar(64) | NO | UNI | | | | |
| type | varchar(32) | NO | | | | | |
| title | varchar(128) | NO | | | | | |
| body | text | NO | | NULL | | | |
| signature_threshold | int(11) | NO | | 0 | | | |
| signature_count | int(11) | NO | | 0 | | | |
| signatures_needed | int(11) | NO | | 0 | | | |
| url | varchar(512) | NO | | | | | |
| deadline | int(11) | NO | | 0 | | | |
| status | varchar(32) | NO | | | | | |
| created | int(11) | NO | | 0 | | | |
+---------------------+--------------+------+-----+---------+----------------+ | |
12 rows in set (0.00 sec) | |
MariaDB [whpet_dump]> describe wtp_data_responses; | |
+-------+--------------+------+-----+---------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+-------+--------------+------+-----+---------+-------+ | |
| id | varchar(64) | NO | PRI | | | | |
| url | varchar(256) | NO | | | | | |
+-------+--------------+------+-----+---------+-------+ | |
2 rows in set (0.00 sec) | |
MariaDB [whpet_dump]> describe wtp_data_petition_responses; | |
+------------------+-------------+------+-----+---------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+------------------+-------------+------+-----+---------+-------+ | |
| petition_id | varchar(64) | NO | | | | | |
| response_id | varchar(64) | NO | | | | | |
| association_time | int(11) | NO | | 0 | | | |
+------------------+-------------+------+-----+---------+-------+ | |
3 rows in set (0.01 sec) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment