class Agent(BASE): """Class defining the iset_agent table of the database.""" __tablename__ = 'iset_agent' __table_args__ = { 'mysql_engine': 'InnoDB' } idx_agent = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) id_agent = Column(VARBINARY(512), unique=True, nullable=True, default=None) name = Column(VARBINARY(512), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') last_timestamp = Column( BIGINT(unsigned=True), nullable=False, server_default='0') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class RiderDevices(BASE): """Class defining the mdl_ridersdevices table of the database.""" __tablename__ = 'mdl_ridersdevices' __table_args__ = (UniqueConstraint('id_riderdevice'), { 'mysql_engine': 'InnoDB' }) idx_riderdevice = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_rider = Column(BIGINT(unsigned=True), ForeignKey('mdl_riders.idx_rider'), nullable=False, server_default='1') idx_devicemodel = Column(BIGINT(unsigned=True), ForeignKey('mdl_devicemodels.idx_devicemodel'), nullable=False, server_default='1') id_riderdevice = Column(VARBINARY(512), nullable=True, default=None) serial_riderdevice = Column(VARBINARY(128), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Configuration(BASE): """Class defining the iset_configuration table of the database.""" __tablename__ = 'iset_configuration' __table_args__ = ( UniqueConstraint( 'config_key'), { 'mysql_engine': 'InnoDB' } ) idx_configuration = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) config_key = Column(VARBINARY(512), nullable=True, default=None) config_value = Column(VARBINARY(512), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Chart(BASE): """Class defining the pt_chart table of the database.""" __tablename__ = 'pt_chart' __table_args__ = ( {'mysql_engine': 'InnoDB'} ) idx_chart = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) name = Column( VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) checksum = Column( VARBINARY(512), unique=True, nullable=True, default=None) enabled = Column( BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Device(BASE): """Class defining the iset_device table of the database.""" __tablename__ = 'iset_device' __table_args__ = ( UniqueConstraint( 'devicename'), { 'mysql_engine': 'InnoDB' } ) idx_device = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) devicename = Column(VARBINARY(512), nullable=True, default=None) description = Column(VARBINARY(512), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ip_address = Column(VARBINARY(512), nullable=True, default=None) ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Reputation_Data(Base): __tablename__ = 'reputation_data' rep_ip_dst = Column('rep_ip_dst', VARBINARY(16), primary_key=False) rep_rel_dst = Column('rep_rel_dst', TINYINT, primary_key=False) event_id = Column('event_id', BINARY(16), ForeignKey('acid_event.id'), primary_key=True) rep_rel_src = Column('rep_rel_src', TINYINT, primary_key=False) rep_prio_dst = Column('rep_prio_dst', TINYINT, primary_key=False) rep_act_dst = Column('rep_act_dst', VARCHAR(64), primary_key=False) rep_ip_src = Column('rep_ip_src', VARBINARY(16), primary_key=False) rep_act_src = Column('rep_act_src', VARCHAR(64), primary_key=False) rep_prio_src = Column('rep_prio_src', TINYINT, primary_key=False) # # Relations: # @property def serialize(self): return { 'rep_ip_dst': get_ip_str_from_bytes(self.rep_ip_dst), 'rep_rel_dst': self.rep_rel_dst, 'event_id': get_uuid_string_from_bytes(self.event_id), 'rep_rel_src': self.rep_rel_src, 'rep_prio_dst': self.rep_prio_dst, 'rep_act_dst': self.rep_act_dst, 'rep_ip_src': get_ip_str_from_bytes(self.rep_ip_src), 'rep_act_src': self.rep_act_src, 'rep_prio_src': self.rep_prio_src, }
class Language(BASE): """Class defining the pt_language table of the database.""" __tablename__ = 'pt_language' __table_args__ = (UniqueConstraint('code'), {'mysql_engine': 'InnoDB'}) idx_language = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) code = Column(VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) name = Column(VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) enabled = Column(BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Riders(BASE): """Class defining the mdl_riders table of the database.""" __tablename__ = 'mdl_riders' __table_args__ = ({'mysql_engine': 'InnoDB'}) idx_rider = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) first_name = Column(VARBINARY(50), nullable=True, default=None) last_name = Column(VARBINARY(50), nullable=True, default=None) password = Column(VARBINARY(512), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class PairXlate(BASE): """Class defining the pt_pair_xlate table of the database.""" __tablename__ = 'pt_pair_xlate' __table_args__ = ( UniqueConstraint('idx_language', 'key', 'idx_pair_xlate_group'), {'mysql_engine': 'InnoDB'} ) idx_pair_xlate = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_pair_xlate_group = Column( BIGINT(unsigned=True), ForeignKey('pt_pair_xlate_group.idx_pair_xlate_group'), index=True, nullable=False, server_default='1') idx_language = Column( BIGINT(unsigned=True), ForeignKey('pt_language.idx_language'), index=True, nullable=False, server_default='1') key = Column( VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) translation = Column( VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) units = Column( VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) enabled = Column( BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP')) # Use cascade='delete,all' to propagate the deletion of a # PairXlateGroup onto its PairXlate pair_xlate_group = relationship( PairXlateGroup, backref=backref( 'pair_xlate_pair_xlate_group', uselist=True, cascade='delete,all')) # Use cascade='delete,all' to propagate the deletion of a # Language onto its PairXlate language = relationship( Language, backref=backref( 'pair_xlate_language', uselist=True, cascade='delete,all'))
class Datapoint(BASE): """Class defining the iset_datapoint table of the database.""" __tablename__ = 'iset_datapoint' __table_args__ = ( { 'mysql_engine': 'InnoDB' } ) idx_datapoint = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_agent = Column( BIGINT(unsigned=True), ForeignKey('iset_agent.idx_agent'), nullable=False, server_default='1') idx_device = Column( BIGINT(unsigned=True), ForeignKey('iset_device.idx_device'), nullable=False, server_default='1') idx_department = Column( BIGINT(unsigned=True), ForeignKey('iset_department.idx_department'), nullable=False, server_default='1') idx_billcode = Column( BIGINT(unsigned=True), ForeignKey('iset_billcode.idx_billcode'), nullable=False, server_default='1') id_datapoint = Column( VARBINARY(512), unique=True, nullable=True, default=None) agent_label = Column(VARBINARY(512), nullable=True, default=None) agent_source = Column(VARBINARY(512), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') billable = Column(INTEGER(unsigned=True), server_default='0') timefixed_value = Column(VARBINARY(512), nullable=True, default=None) base_type = Column(INTEGER(unsigned=True), server_default='1') last_timestamp = Column( BIGINT(unsigned=True), nullable=False, server_default='0') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class CentralAuthLocalUser(db.CentralAuthBase): __tablename__ = 'localuser' lu_wiki = Column(VARBINARY(255), primary_key=True) lu_name = Column(VARBINARY(255), primary_key=True) lu_attached_timestamp = Column(VARBINARY(14)) lu_attached_method = Column(ENUM('primary', 'empty', 'mail', 'password', 'admin', 'new', 'login'))
def column(**kwargs): _type = kwargs.pop('type', None) if _type is None: raise Exception('[DB/BaseModel]: type should be set') length = kwargs.pop('length', 255) col = { 'string': VARCHAR(length=length), 'integer': INTEGER, 'float': FLOAT, 'varbinary': VARBINARY(length=length), 'tinyint': TINYINT, 'mediumint': MEDIUMINT, 'smallint': SMALLINT, }[_type] foreign_key = kwargs.pop('foreign_key', None) if foreign_key: foreign_key = ForeignKey(foreign_key, onupdate='CASCADE', ondelete='CASCADE') return Column(col, foreign_key, **kwargs) return Column(col, **kwargs)
class WP_Page(Base): '''Schema for MediaWiki page table (for wikipedia dumps).''' __tablename__ = 'page' page_id = Column(INTEGER(unsigned=True), primary_key=True) page_namespace = Column(INTEGER) page_title = Column(VARBINARY(255)) page_restrictions = Column(TINYBLOB) page_counter = Column(BIGINT(unsigned=True)) page_is_redirect = Column(TINYINT(unsigned=True)) page_is_new = Column(TINYINT(unsigned=True)) page_random = Column(DOUBLE(unsigned=True)) page_touched = Column(VARBINARY(14)) page_links_updated = Column(VARBINARY(14)) page_latest = Column(INTEGER(unsigned=True)) page_len = Column(INTEGER(unsigned=True)) page_content_model = Column(VARBINARY(32))
class WikiUserStore(db.WikimetricsBase): """ This class represents mediawiki users which compose cohorts. A user is defined as a username or user_id along with the project name on which that user registered. This class is mapped to the wiki_user table using sqlalchemy.declarative """ __tablename__ = 'wiki_user' id = Column(Integer, primary_key=True) raw_id_or_name = Column(VARBINARY(255)) mediawiki_username = Column(String(255)) mediawiki_userid = Column(Integer) project = Column(String(45)) # valid = None means it's not been validated yet # valid = True means it's valid # valid = False means it's invalid valid = Column(Boolean, default=None) reason_invalid = Column(String(200)) # The cohort id that this wikiuser is being validated for validating_cohort = Column(Integer) __table_args__ = (UniqueConstraint(project, mediawiki_userid, validating_cohort, name='ix_wiki_user_project'), ) def __repr__(self): return '<WikiUserStore("{0}")>'.format(self.id)
class GeoCities(BASE): """Class defining the mdl_geocities table of the database.""" __tablename__ = 'mdl_geocities' __table_args__ = ({'mysql_engine': 'InnoDB'}) idx_geocity = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_georegion = Column(BIGINT(unsigned=True), ForeignKey('mdl_georegions.idx_georegion'), nullable=False, server_default='1') geocity_name = Column(VARBINARY(128), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class VehicleModels(BASE): """Class defining the mdl_vehiclemodels table of the database.""" __tablename__ = 'mdl_vehiclemodels' __table_args__ = (UniqueConstraint('idx_vehiclemodel', 'idx_vehiclemake'), { 'mysql_engine': 'InnoDB' }) idx_vehiclemodel = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_vehiclemake = Column(BIGINT(unsigned=True), ForeignKey('mdl_vehiclemakes.idx_vehiclemake'), nullable=False, server_default='1') model_name = Column(VARBINARY(50), nullable=True, default=None) enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Vehicles(BASE): """Class defining the mdl_vehicles table of the database.""" __tablename__ = 'mdl_vehicles' __table_args__ = ({'mysql_engine': 'InnoDB'}) idx_vehicle = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_vehiclemodel = Column(BIGINT(unsigned=True), ForeignKey('mdl_vehiclemodels.idx_vehiclemodel'), nullable=False, server_default='1') license_plate = Column(VARBINARY(50), nullable=True, default=None) vehicle_seats = Column(INTEGER(unsigned=True), server_default='5') vehicle_year = Column(INTEGER(unsigned=True), default=None) rating_value = Column(FLOAT, server_default='0') enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Drivers(BASE): """Class defining the mdl_drivers table of the database.""" __tablename__ = 'mdl_drivers' __table_args__ = ({'mysql_engine': 'InnoDB'}) idx_driver = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_drivercompany = Column( BIGINT(unsigned=True), ForeignKey('mdl_drivercompanies.idx_drivercompany'), nullable=False, server_default='1') idx_address = Column(BIGINT(unsigned=True), ForeignKey('mdl_addresses.idx_address'), nullable=False, server_default='1') idx_billaddress = Column(BIGINT(unsigned=True), ForeignKey('mdl_billaddresses.idx_billaddress'), nullable=False, server_default='1') first_name = Column(VARBINARY(50), nullable=True, default=None) last_name = Column(VARBINARY(50), nullable=True, default=None) email = Column(String(50), nullable=False) password = Column(VARBINARY(512), nullable=True, default=None) rating_value = Column(FLOAT, server_default='0') off_duty = Column(INTEGER(unsigned=True), server_default='0') enabled = Column(INTEGER(unsigned=True), server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Agent(BASE): """Class defining the pt_agent table of the database.""" __tablename__ = 'pt_agent' __table_args__ = (UniqueConstraint('agent_id', 'agent_polled_target'), { 'mysql_engine': 'InnoDB' }) idx_agent = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_agent_group = Column(BIGINT(unsigned=True), ForeignKey('pt_agent_group.idx_agent_group'), index=True, nullable=False, server_default='1') agent_id = Column(VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) agent_polled_target = Column(VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) agent_program = Column(VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) enabled = Column(BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP')) # Use cascade='delete,all' to propagate the deletion of a # PairXlateGroup onto its PairXlate agent_group = relationship(AgentGroup, backref=backref('agent_agent_group', uselist=True, cascade='delete,all'))
class MediawikiUserGroups(db.MediawikiBase): __tablename__ = 'user_groups' ug_user = Column(Integer, ForeignKey('user.user_id'), nullable=False, default=0, primary_key=True) ug_group = Column(VARBINARY(255), nullable=False, primary_key=True)
class User(BASE): """Class defining the pt_user table of the database.""" __tablename__ = 'pt_user' __table_args__ = ( UniqueConstraint('username'), {'mysql_engine': 'InnoDB'} ) idx_user = Column( BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) first_name = Column( VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) last_name = Column( VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) username = Column( VARBINARY(MAX_KEYPAIR_LENGTH), index=True, nullable=False, default=None) password = Column( VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) role = Column( BIGINT(unsigned=True), nullable=False, server_default='1') password_expired = Column( BIGINT(unsigned=True), nullable=False, server_default='1') enabled = Column( BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),) ts_created = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP'))
class Users(Base): # 表的名字: __tablename__ = 'users' # 表的结构: #OPc = Column(VARBINARY(16)) #key = Column(VARBINARY(16)) #imei = Column(VARCHAR(15)) imsi = Column(VARCHAR(15), primary_key=True) msisdn = Column(VARCHAR(46)) imei = Column(VARCHAR(15)) rau_tau_timer = Column(INTEGER(10)) ue_ambr_ul = Column(BIGINT(20)) ue_ambr_dl = Column(BIGINT(20)) access_restriction = Column(INTEGER(10)) mmeidentity_idmmeidentity = Column(INTEGER(11)) key = Column(VARBINARY(16)) rand = Column(VARBINARY(16)) OPc = Column(VARBINARY(16))
class AgentXlate(BASE): """Class defining the pt_agent_xlate table of the database.""" __tablename__ = 'pt_agent_xlate' __table_args__ = (UniqueConstraint('idx_language', 'agent_program'), { 'mysql_engine': 'InnoDB' }) idx_agent_xlate = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True, nullable=False) idx_language = Column(BIGINT(unsigned=True), ForeignKey('pt_language.idx_language'), index=True, nullable=False, server_default='1') agent_program = Column(VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) translation = Column(VARBINARY(MAX_KEYPAIR_LENGTH), nullable=False, default=None) enabled = Column(BIGINT(unsigned=True), nullable=False, server_default='1') ts_modified = Column( DATETIME, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) ts_created = Column(DATETIME, server_default=text('CURRENT_TIMESTAMP')) # Use cascade='delete,all' to propagate the deletion of a row # to rows in the tables used by foreign keys language = relationship(Language, backref=backref('agent_xlate_language', uselist=True, cascade='delete,all'))
class Users(Base): # 表的名字: __tablename__ = 'users' # 表的结构: #id = Column(String(20), primary_key=True) #name = Column(String(20)) #sqn = Column(BigInteger(20)) OPc = Column(VARBINARY(160)) imei = Column(VARCHAR(15)) imsi = Column(String(15),primary_key = True)
class MediawikiUser(db.MediawikiBase): __tablename__ = 'user' # defaults are for user generating data methods # VARBINARY bindings are needed so the table user we create # in the mediawiki testing database resembles the table in production user_id = Column(Integer, primary_key=True) user_name = Column(VARBINARY(255)) user_real_name = Column(VARBINARY(255), nullable=False, default='') user_password = Column(TINYBLOB, nullable=False, default='') user_newpassword = Column(TINYBLOB, nullable=False, default='') user_newpass_time = Column(MediawikiTimestamp) user_email = Column(String(255), nullable=False, default='') user_touched = Column(MediawikiTimestamp, nullable=False, default=UNICODE_NULL * 14) user_token = Column(String(255), nullable=False, default=UNICODE_NULL * 32) user_email_authenticated = Column(MediawikiTimestamp) user_email_token = Column(String(255)) user_email_token_expires = Column(MediawikiTimestamp) user_registration = Column(MediawikiTimestamp) user_editcount = Column(Integer)
class ProjectRevision(Base): __tablename__ = '%s_revisions' % project_name internal_id = Column(Integer, primary_key=True) revision_id = Column(Integer) article_name = Column(VARBINARY(255)) article_namespace = Column(Integer) revision_num = Column(Integer) article_id = Column(Integer) contributor_id = Column(Integer) contributor_name = Column(VARBINARY(255)) redirect = Column(VARBINARY(255)) minor = Column(Boolean) comment = Column(VARBINARY(255)) length_bytes = Column(Integer) diff_bytes = Column(Integer) timestamp = Column(Integer) deleted = Column(Boolean) important = Column(Boolean) def __init__(self, *args, **kwargs): clean_revision(kwargs) Base.__init__(self, *args, **kwargs)
class Archive(db.MediawikiBase): """ Full table definition is not needed, but here it is for reference: +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ | ar_id | int(10) unsigned | NO | | 0 | | | ar_namespace | int(11) | NO | | 0 | | | ar_title | varbinary(255) | NO | | | | | ar_text | binary(0) | YES | | NULL | | | ar_comment | binary(0) | YES | | NULL | | | ar_user | bigint(10) unsigned | YES | | NULL | | | ar_user_text | varbinary(255) | YES | | NULL | | | ar_timestamp | varbinary(14) | NO | | | | | ar_minor_edit | tinyint(1) | NO | | 0 | | | ar_flags | tinyblob | NO | | NULL | | | ar_rev_id | int(8) unsigned | YES | | NULL | | | ar_text_id | bigint(10) unsigned | YES | | NULL | | | ar_deleted | tinyint(1) unsigned | NO | | 0 | | | ar_len | bigint(10) unsigned | YES | | NULL | | | ar_page_id | int(10) unsigned | YES | | NULL | | | ar_parent_id | int(10) unsigned | YES | | NULL | | | ar_sha1 | varbinary(32) | YES | | NULL | | +---------------+---------------------+------+-----+---------+-------+ """ __tablename__ = db.config['ARCHIVE_TABLENAME'] ar_id = Column(Integer, primary_key=True) ar_namespace = Column(Integer, nullable=False, default=0) ar_title = Column(VARBINARY(255), nullable=False, default='') ar_user = Column(Integer) ar_user_text = Column(VARBINARY(255)) ar_timestamp = Column(MediawikiTimestamp, nullable=False, default=UNICODE_NULL * 14) ar_minor_edit = Column(Boolean, nullable=False, default=False) ar_flags = Column(TINYBLOB, nullable=False, default='') ar_rev_id = Column(Integer, nullable=True) ar_deleted = Column(Boolean, nullable=False, default=False) ar_page_id = Column(Integer, nullable=True) ar_parent_id = Column(Integer, nullable=True)
class Rating(Base): __tablename__ = 'ratings' internal_id = Column(Integer, primary_key=True) project_unique = Column(VARBINARY(255)) project_name = Column(String(255)) project_id = Column(Integer) timestamp = Column(Integer) action = Column(String(32)) article_name = Column(VARBINARY(255)) talk_name = Column(VARBINARY(255)) old_quality = Column(String(32)) new_quality = Column(String(32)) old_importance = Column(String(32)) new_importance = Column(String(32)) important = Column(Boolean) new_article_name = Column(VARBINARY(255)) old_article_url = Column(String(512)) new_article_url = Column(String(512)) article_id = Column(Integer) talk_id = Column(Integer) added_ga = Column(Boolean) first_gf = Column(Boolean)
class ua_session_data(db.Model): __tablename__ = 'ua_session_data' ua_sb_key = db.Column(db.String(128), db.ForeignKey('ua_session_base.ua_sb_key'), primary_key=True) ua_sd_key = db.Column(db.String(64), primary_key=True) ua_sd_value = db.Column(VARBINARY(512)) ua_sd_type = db.Column(db.String(8)) def __init__(self, **kwargs): super(ua_session_data, self).__init__(**kwargs) def __repr__(self): return '<ua_session_data %r>' % self.ua_sd_key
def upgrade(): op.create_table('tag', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', VARBINARY(50), nullable=False), sa.PrimaryKeyConstraint('id')) op.create_table('cohort_tag', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cohort_id', sa.Integer(), nullable=False), sa.Column('tag_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['cohort_id'], ['cohort.id'], ), sa.ForeignKeyConstraint( ['tag_id'], ['tag.id'], ), sa.PrimaryKeyConstraint('id')) op.create_unique_constraint('uix_tag', 'tag', ['name'])