예제 #1
0
def upgrade_test():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('subreddit_pages',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('page_type', sa.Integer(), nullable=True),
                    sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'subreddits',
        sa.Column('id',
                  sa.String(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.Column('name', sa.String(length=32), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_table(
        'posts',
        sa.Column('id',
                  sa.String(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.Column('subreddit_id', sa.String(length=32), nullable=True),
        sa.Column('created', sa.DateTime(), nullable=True),
        sa.Column('post_data', mysql.MEDIUMTEXT(), nullable=True),
        sa.ForeignKeyConstraint(
            ['subreddit_id'],
            ['subreddits.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.add_column('front_pages',
                  sa.Column('page_type', sa.Integer(), nullable=True))
예제 #2
0
class Scraper(db.Model):
    __tablename__ = 'rss_feed_scrapped'
    id = db.Column(BigInteger, primary_key=True, autoincrement=True)
    # not sure if required now the below field
    # scraper_name = db.Column(mysql_t.TEXT(), nullable=False)
    rss_feed_id = db.Column(
        BigInteger,
        ForeignKey('rss_feed.id', onupdate='CASCADE', ondelete='CASCADE'))
    uri = db.Column(mysql_t.MEDIUMTEXT(), nullable=False)
    headline = db.Column(mysql_t.MEDIUMTEXT(), nullable=False)
    story_kicker = db.Column(mysql_t.MEDIUMTEXT())
    article = db.Column(mysql_t.LONGTEXT())
    created_at = db.Column(mysql_t.TIMESTAMP(fsp=6),
                           nullable=False,
                           server_default=current_timestamp(6))

    # not that important in the context
    # updated_at = db.Column(mysql_t.TIMESTAMP(fsp=6), nullable=False,
    #                     server_default=current_timestamp(6), server_onupdate=current_timestamp(6))

    def __repr__(self):
        return {
            'id': self.id,
            'rss_feed_id': self.rss_feed_id,
            'uri': self.uri,
            'headline': self.headline,
            'story_kicker': self.story_kicker,
            'article': self.article,
            'created_at': self.created_at
        }
예제 #3
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('record_pk', 'response',
               existing_type=mysql.MEDIUMTEXT(collation='utf8_bin'),
               nullable=False)
    op.alter_column('record_pk', 'address',
               existing_type=mysql.MEDIUMTEXT(collation='utf8_bin'),
               nullable=False)
    op.drop_table('token_node_conf')
    op.drop_table('record_sign')
예제 #4
0
class ScrapperConfiguration(db.Model):
    __tablename__ = 'scrapper_config'
    id = db.Column(BigInteger, primary_key=True, autoincrement=True)
    scrapper_name = db.Column(mysql_t.TEXT(), nullable=False)
    headline = db.Column(mysql_t.MEDIUMTEXT(), nullable=True)
    date_time = db.Column(mysql_t.TEXT(), nullable=True)
    article = db.Column(mysql_t.LONGTEXT(), nullable=True)
    story_kicker = db.Column(mysql_t.MEDIUMTEXT(), nullable=True)
    created_at = db.Column(mysql_t.TIMESTAMP(fsp=6),
                           nullable=False,
                           server_default=current_timestamp(6))
예제 #5
0
def downgrade():
    op.add_column(
        u'project',
        sa.Column('gh_key_id', mysql.INTEGER(display_width=11),
                  nullable=False))
    op.add_column(
        u'project',
        sa.Column('rsa_private_key', mysql.MEDIUMTEXT(), nullable=False))
    op.add_column(
        u'project',
        sa.Column('rsa_public_key', mysql.MEDIUMTEXT(), nullable=False))
    op.drop_table('deploy_key')
예제 #6
0
class RSSFeed(db.Model):
    __tablename__ = 'rss_feed'
    id = db.Column(BigInteger, primary_key=True, autoincrement=True)
    source_url = db.Column(
        VARCHAR(3000),
        ForeignKey('rss_source.url', onupdate='CASCADE', ondelete='CASCADE'))
    link = db.Column(mysql_t.MEDIUMTEXT())
    title = db.Column(mysql_t.MEDIUMTEXT())
    summary = db.Column(mysql_t.LONGTEXT())
    published_string = db.Column(mysql_t.MEDIUMTEXT())
    published_at = db.Column(DateTime, default=None)
    created_at = db.Column(mysql_t.TIMESTAMP(fsp=6),
                           nullable=False,
                           server_default=current_timestamp(6))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'extension',
        sa.Column('created',
                  sa.DateTime(timezone=True),
                  server_default=sa.text('now()'),
                  nullable=False), sa.Column('id',
                                             sa.Integer(),
                                             nullable=False),
        sa.Column('staff_id', sa.Integer(), nullable=False),
        sa.Column('assignment_id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('message', mysql.MEDIUMTEXT(), nullable=True),
        sa.Column('expires', sa.DateTime(timezone=True), nullable=True),
        sa.Column('custom_submission_time',
                  sa.DateTime(timezone=True),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['assignment_id'], ['assignment.id'],
            name=op.f('fk_extension_assignment_id_assignment')),
        sa.ForeignKeyConstraint(['staff_id'], ['user.id'],
                                name=op.f('fk_extension_staff_id_user')),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name=op.f('fk_extension_user_id_user')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_extension')),
        sa.UniqueConstraint('assignment_id',
                            'user_id',
                            name=op.f('uq_extension_assignment_id_user_id')))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('candidates',
                    sa.Column('candidate_id', sa.Integer(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('lang', mysql.TINYTEXT(), nullable=True),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('user_name', mysql.TINYTEXT(), nullable=True),
                    sa.Column('user_registration',
                              sa.DateTime(),
                              nullable=True),
                    sa.Column('user_editcount', sa.Integer(), nullable=True),
                    sa.Column('user_experience_level',
                              mysql.TINYTEXT(),
                              nullable=True),
                    sa.Column('thanks_sent', sa.Integer(), nullable=True),
                    sa.Column('thanks_received', sa.Integer(), nullable=True),
                    sa.Column('has_email', sa.Boolean(), nullable=True),
                    sa.Column('user_thanked', sa.Boolean(), nullable=True),
                    sa.PrimaryKeyConstraint('candidate_id'),
                    mysql_charset='utf8',
                    mysql_collate='utf8_general_ci',
                    mysql_engine='InnoDB')
    op.create_index(op.f('ix_candidates_created_at'),
                    'candidates', ['created_at'],
                    unique=False)
    op.create_index(op.f('ix_candidates_user_id'),
                    'candidates', ['user_id'],
                    unique=False)
    op.create_table('edits',
                    sa.Column('edit_id', sa.Integer(), nullable=False),
                    sa.Column('candidate_id', sa.Integer(), nullable=True),
                    sa.Column('lang', mysql.TINYTEXT(), nullable=True),
                    sa.Column('rev_id', sa.Integer(), nullable=True),
                    sa.Column('page_name', sa.TEXT(), nullable=True),
                    sa.Column('page_id', sa.Integer(), nullable=True),
                    sa.Column('ores_damaging', sa.Boolean(), nullable=True),
                    sa.Column('ores_goodfaith', sa.Boolean(), nullable=True),
                    sa.Column('de_flagged', sa.Boolean(), nullable=True),
                    sa.Column('de_flagged_algo_version',
                              sa.Boolean(),
                              nullable=True),
                    sa.Column('edit_deleted', sa.NullType(), nullable=True),
                    sa.Column('diffHTML', mysql.MEDIUMTEXT(), nullable=True),
                    sa.Column('newRevId', sa.Integer(), nullable=True),
                    sa.Column('newRevDate', mysql.TINYTEXT(), nullable=True),
                    sa.Column('newRevUser', mysql.TINYTEXT(), nullable=True),
                    sa.Column('newRevComment', sa.TEXT(), nullable=True),
                    sa.Column('oldRevId', sa.Integer(), nullable=True),
                    sa.Column('oldRevDate', mysql.TINYTEXT(), nullable=True),
                    sa.Column('oldRevUser', mysql.TINYTEXT(), nullable=True),
                    sa.Column('oldRevComment', sa.TEXT(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['candidate_id'],
                        ['candidates.candidate_id'],
                    ),
                    sa.PrimaryKeyConstraint('edit_id'),
                    mysql_charset='utf8',
                    mysql_collate='utf8_general_ci',
                    mysql_engine='InnoDB')
예제 #9
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'mp_os_migration_status',
        sa.Column('rid', sa.BigInteger(), nullable=False, autoincrement=True),
        sa.Column('cuuid',
                  sa.String(length=50),
                  server_default='',
                  nullable=False),
        sa.Column('startDateTime',
                  sa.DateTime(),
                  server_default='1970-01-01 00:00:00',
                  nullable=False),
        sa.Column('stopDateTime',
                  sa.DateTime(),
                  server_default='1970-01-01 00:00:00',
                  nullable=True),
        sa.Column('preOSVer',
                  sa.String(length=255),
                  server_default='NA',
                  nullable=False),
        sa.Column('postOSVer',
                  sa.String(length=255),
                  server_default='NA',
                  nullable=True),
        sa.Column('label', mysql.MEDIUMTEXT(), nullable=True),
        sa.Column('migrationID', sa.String(length=100), nullable=True),
        sa.PrimaryKeyConstraint('rid'))

    op.create_index(op.f('ix_os_migration_status_cuuid'),
                    'mp_os_migration_status', ['cuuid'],
                    unique=False)
예제 #10
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('article',
                    sa.Column('id', sa.String(length=16), nullable=False),
                    sa.Column('title', sa.String(length=255), nullable=False),
                    sa.Column('category_id',
                              sa.String(length=16),
                              nullable=False),
                    sa.Column('content', mysql.MEDIUMTEXT(), nullable=False),
                    sa.Column('count', sa.Integer(), nullable=True),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('keywords', sa.Text(), nullable=True),
                    sa.Column('status', sa.Integer(), nullable=True),
                    sa.Column('display_time',
                              sa.String(length=30),
                              nullable=True),
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_charset='utf8',
                    mysql_engine='InnoDB')
    op.create_table('category',
                    sa.Column('id', sa.String(length=16), nullable=False),
                    sa.Column('site_code',
                              sa.String(length=20),
                              nullable=False),
                    sa.Column('code', sa.String(length=20), nullable=False),
                    sa.Column('name', sa.String(length=255), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_charset='utf8',
                    mysql_engine='InnoDB')
    op.create_table('site',
                    sa.Column('id', sa.String(length=16), nullable=False),
                    sa.Column('name', sa.String(length=50), nullable=False),
                    sa.Column('code', sa.String(length=20), nullable=False),
                    sa.Column('desc', sa.String(length=255), nullable=True),
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('code'),
                    mysql_charset='utf8',
                    mysql_engine='InnoDB')
    op.create_table('user',
                    sa.Column('id', sa.String(length=16), nullable=False),
                    sa.Column('username', sa.String(length=50),
                              nullable=False),
                    sa.Column('password_hash',
                              sa.String(length=50),
                              nullable=False),
                    sa.Column('salt', sa.String(length=50), nullable=False),
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('last_login_time', sa.DateTime(), nullable=True),
                    sa.Column('soft_del', sa.Boolean(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('username'),
                    mysql_charset='utf8',
                    mysql_engine='InnoDB')
    op.drop_index('name', table_name='seo')
    op.drop_table('seo')
def upgrade_test():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'archived_comments',
        sa.Column('id',
                  sa.String(length=256),
                  autoincrement=False,
                  nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('created_utc', sa.DateTime(), nullable=True),
        sa.Column('subreddit_id', sa.String(length=32), nullable=True),
        sa.Column('post_id', sa.String(length=32), nullable=True),
        sa.Column('user_id', sa.String(length=64), nullable=True),
        sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_index(op.f('ix_archived_comments_created_at'),
                    'archived_comments', ['created_at'],
                    unique=False)
    op.create_index(op.f('ix_archived_comments_post_id'),
                    'archived_comments', ['post_id'],
                    unique=False)
    op.create_index(op.f('ix_archived_comments_subreddit_id'),
                    'archived_comments', ['subreddit_id'],
                    unique=False)
    op.create_index(op.f('ix_archived_comments_user_id'),
                    'archived_comments', ['user_id'],
                    unique=False)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('twitter_tweets',
                    sa.Column('uid', sa.VARCHAR(length=40), nullable=False),
                    sa.Column('created_at', sa.DATETIME(), nullable=False),
                    sa.Column('retweet', sa.BOOLEAN(), nullable=False),
                    sa.Column('lang', sa.VARCHAR(length=10), nullable=False),
                    sa.Column('text',
                              mysql.MEDIUMTEXT(convert_unicode=True),
                              nullable=True),
                    sa.Column('ref_uid', sa.VARCHAR(length=40), nullable=True),
                    sa.Column('username',
                              sa.VARCHAR(length=100),
                              nullable=True),
                    sa.Column('userid', sa.VARCHAR(length=100), nullable=True),
                    sa.PrimaryKeyConstraint('uid'),
                    mysql_CHARSET='utf8',
                    mysql_COLLATE='utf8_unicode_ci')
    op.create_table(
        'twitter_tweet_samples',
        sa.Column('metric', sa.VARCHAR(length=190), nullable=False),
        sa.Column('msg_uid',
                  sa.VARCHAR(length=40),
                  server_default='',
                  nullable=False),
        sa.Column('agg_ts', sa.DATETIME(), nullable=False),
        sa.ForeignKeyConstraint(['msg_uid'], [u'twitter_tweets.uid'],
                                name='twitter_tweet_samples_to_twitter_fk',
                                onupdate='CASCADE',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('metric', 'msg_uid'),
        mysql_CHARSET='utf8',
        mysql_COLLATE='utf8_unicode_ci')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('draft_v2', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.Column('state', sa.String(length=32), nullable=True),
                    sa.Column('name', sa.String(length=64), nullable=True),
                    sa.Column('data_json', mysql.MEDIUMTEXT(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_draft_v2_timestamp'),
                    'draft_v2', ['timestamp'],
                    unique=False)
    op.create_table('draft_user_link',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('draft_id', sa.Integer(), nullable=False),
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['draft_id'],
                        ['draft_v2.id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table('draft_achievement_link',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('draft_id', sa.Integer(), nullable=False),
                    sa.Column('ach_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['ach_id'],
                        ['achievement.id'],
                    ), sa.ForeignKeyConstraint(
                        ['draft_id'],
                        ['draft_v2.id'],
                    ), sa.PrimaryKeyConstraint('id'))
예제 #14
0
class Forums(db.Model):
    __bind_key__ = 'bbs'
    __tablename__ = 'forums'
    __table_args__ = {'schema': 'bbs'}

    forum_id = db.Column('forum_id',
                         mysql.INTEGER(display_width=11),
                         primary_key=True,
                         nullable=False)
    name = db.Column('name',
                     VARCHAR(collation=u'utf8mb4_unicode_ci', length=100),
                     nullable=False)
    description = db.Column('description',
                            VARCHAR(collation=u'utf8mb4_unicode_ci',
                                    length=500),
                            nullable=False)
    image = db.Column('image',
                      mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
    province_id = db.Column(
        'province_id', VARCHAR(collation=u'utf8mb4_unicode_ci', length=20))
    major_id = db.Column('major_id',
                         VARCHAR(collation=u'utf8mb4_unicode_ci', length=20))
    last_modify_time = db.Column('last_modify_time',
                                 mysql.BIGINT(display_width=20),
                                 nullable=False)
예제 #15
0
def upgrade_production():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('front_pages', sa.Column('id',
                                             sa.Integer(),
                                             nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
예제 #16
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('ibm_credentials',
                    'access_token',
                    existing_type=mysql.TEXT(),
                    nullable=False)
    op.add_column(
        'ibm_tasks',
        sa.Column('request_payload', mysql.MEDIUMTEXT(), nullable=True))
예제 #17
0
class Comments(db.Model):
    __bind_key__ = 'bbs'
    __tablename__ = 'comments'
    __table_args__ = {'schema': 'bbs'}

    comment_id = db.Column('comment_id',
                           mysql.INTEGER(display_width=11),
                           primary_key=True,
                           nullable=False)
    content = db.Column('content',
                        mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
    pub_time = db.Column('pub_time',
                         mysql.BIGINT(display_width=20),
                         nullable=False)
    pub_area = db.Column('pub_area',
                         VARCHAR(collation=u'utf8mb4_unicode_ci', length=50))
    pub_client = db.Column('pub_client',
                           VARCHAR(collation=u'utf8mb4_unicode_ci', length=20))
    images = db.Column('images',
                       mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
    status = db.Column('status',
                       mysql.TINYINT(display_width=4),
                       nullable=False)
    topic_id = db.Column('topic_id',
                         mysql.INTEGER(display_width=11),
                         nullable=False)
    forum_id = db.Column('forum_id',
                         mysql.INTEGER(display_width=11),
                         nullable=False)
    user_id = db.Column('user_id',
                        VARCHAR(collation=u'utf8mb4_unicode_ci', length=50),
                        nullable=False)
    user_name = db.Column('user_name',
                          VARCHAR(collation=u'utf8mb4_unicode_ci', length=50),
                          nullable=False)
    reply_id = db.Column('reply_id', mysql.INTEGER(display_width=11))
    reply_floor_no = db.Column('reply_floor_no',
                               mysql.INTEGER(display_width=11))
    reply_user_id = db.Column(
        'reply_user_id', VARCHAR(collation=u'utf8mb4_unicode_ci', length=50))
    reply_user_name = db.Column(
        'reply_user_name', VARCHAR(collation=u'utf8mb4_unicode_ci', length=50))
    reply_content = db.Column(
        'reply_content', mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
예제 #18
0
class RSSFeedLink(db.Model):
    __tablename__ = 'rss_feeds_link'
    id = db.Column(BigInteger, primary_key=True, autoincrement=True)
    rss_feed_id = db.Column(
        BigInteger,
        ForeignKey('rss_feed.id', onupdate='CASCADE', ondelete='CASCADE'))
    rss_feed_link = db.Column(mysql_t.MEDIUMTEXT(), nullable=False)
    created_at = db.Column(mysql_t.TIMESTAMP(fsp=6),
                           nullable=False,
                           server_default=current_timestamp(6))
def upgrade_production():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('message_logs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('message_sent', sa.Boolean(), nullable=True),
    sa.Column('message_failure_reason', sa.String(length=63), nullable=True),
    sa.Column('platform', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=256), nullable=True),
    sa.Column('subject', sa.String(length=256), nullable=True),
    sa.Column('message_task_id', sa.String(length=256), nullable=True),
    sa.Column('body', mysql.MEDIUMTEXT(), nullable=True),
    sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_message_logs_created_at'), 'message_logs', ['created_at'], unique=False)
    op.create_index(op.f('ix_message_logs_message_task_id'), 'message_logs', ['message_task_id'], unique=False)
    op.create_index(op.f('ix_message_logs_platform'), 'message_logs', ['platform'], unique=False)
    op.create_index(op.f('ix_message_logs_username'), 'message_logs', ['username'], unique=False)
    op.drop_index('ix_mod_actions_created_utc_index', table_name='mod_actions')
예제 #20
0
    def __init__(self, mysql_as_long=False, mysql_as_medium=False):
        super(JsonEncodedType, self).__init__()

        if mysql_as_long and mysql_as_medium:
            raise TypeError("mysql_as_long and mysql_as_medium are mutually "
                            "exclusive")

        if mysql_as_long:
            self.impl = Text().with_variant(mysql.LONGTEXT(), 'mysql')
        elif mysql_as_medium:
            self.impl = Text().with_variant(mysql.MEDIUMTEXT(), 'mysql')
예제 #21
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('candidates',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('user_name', mysql.MEDIUMTEXT(), nullable=True),
                    sa.Column('user_registration',
                              sa.DateTime(),
                              nullable=True),
                    sa.Column('user_editcount', sa.Integer(), nullable=True),
                    sa.Column('candidate_status',
                              mysql.TINYTEXT(),
                              nullable=True),
                    sa.Column('invite_sent', mysql.TINYTEXT(), nullable=True),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('user_id'),
                    mysql_charset='utf8',
                    mysql_collate='utf8_general_ci',
                    mysql_engine='InnoDB')
    op.create_index(op.f('ix_candidates_created_at'),
                    'candidates', ['created_at'],
                    unique=False)
    op.create_index(op.f('ix_candidates_user_registration'),
                    'candidates', ['user_registration'],
                    unique=False)
    op.create_table(
        'predictions', sa.Column('prediction_id', sa.Integer(),
                                 nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('predicted_at', sa.DateTime(), nullable=True),
        sa.Column('user_summary', mysql.JSON(), nullable=True),
        sa.Column('scores', mysql.JSON(), nullable=True),
        sa.Column('pred_min', sa.Float(), nullable=True),
        sa.Column('newcomer_predictions', mysql.JSON(), nullable=True),
        sa.Column('pred_error', mysql.MEDIUMTEXT(), nullable=True),
        sa.PrimaryKeyConstraint('prediction_id'))
    op.create_index(op.f('ix_predictions_predicted_at'),
                    'predictions', ['predicted_at'],
                    unique=False)
    op.create_index(op.f('ix_predictions_user_id'),
                    'predictions', ['user_id'],
                    unique=False)
예제 #22
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments_likes',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('comment_id', sa.Integer(), nullable=True),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['cm_user.id'], )
    )
    op.alter_column('comment', 'content',
               existing_type=mysql.MEDIUMTEXT(collation='utf8mb4_unicode_ci'),
               nullable=True)
예제 #23
0
def upgrade_test():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('experiment_actions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('experiment_id', sa.Integer(), nullable=True),
    sa.Column('praw_key_id', sa.String(length=256), nullable=True),
    sa.Column('action_subject_type', sa.String(length=64), nullable=True),
    sa.Column('action_subject_id', sa.String(length=256), nullable=True),
    sa.Column('action_object_type', sa.String(length=64), nullable=True),
    sa.Column('action_object_id', sa.String(length=256), nullable=True),
    sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_experiment_actions_action_object_id'), 'experiment_actions', ['action_object_id'], unique=False)
    op.create_index(op.f('ix_experiment_actions_action_subject_id'), 'experiment_actions', ['action_subject_id'], unique=False)
    op.create_index(op.f('ix_experiment_actions_experiment_id'), 'experiment_actions', ['experiment_id'], unique=False)
    op.create_index(op.f('ix_experiment_actions_praw_key_id'), 'experiment_actions', ['praw_key_id'], unique=False)
    op.create_table('experiment_things',
    sa.Column('id', sa.String(length=256), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('object_type', sa.Integer(), nullable=True),
    sa.Column('experiment_id', sa.Integer(), nullable=True),
    sa.Column('object_created', sa.DateTime(), nullable=True),
    sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_experiment_things_experiment_id'), 'experiment_things', ['experiment_id'], unique=False)
    op.create_table('experiments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=False),
    sa.Column('controller', sa.String(length=256), nullable=False),
    sa.Column('start_time', sa.DateTime(), nullable=True),
    sa.Column('end_time', sa.DateTime(), nullable=True),
    sa.Column('settings_json', mysql.MEDIUMTEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_experiments_name'), 'experiments', ['name'], unique=False)
예제 #24
0
class Topics(db.Model):
    __bind_key__ = 'bbs'
    __tablename__ = 'topics'
    __table_args__ = {'schema': 'bbs'}

    topic_id = db.Column('topic_id',
                         mysql.INTEGER(display_width=11),
                         primary_key=True,
                         nullable=False)
    title = db.Column('title',
                      VARCHAR(collation=u'utf8mb4_unicode_ci', length=100),
                      nullable=False)
    content = db.Column('content',
                        mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
    pub_time = db.Column('pub_time',
                         mysql.BIGINT(display_width=20),
                         nullable=False)
    pub_area = db.Column('pub_area',
                         VARCHAR(collation=u'utf8mb4_unicode_ci', length=50))
    pub_client = db.Column('pub_client',
                           VARCHAR(collation=u'utf8mb4_unicode_ci', length=20))
    images = db.Column('images',
                       mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'))
    status = db.Column('status',
                       mysql.TINYINT(display_width=4),
                       nullable=False)  #2置顶,1普通,0删除
    topic_level = db.Column('topic_level',
                            mysql.TINYINT(display_width=4),
                            nullable=False)  #1精华帖,0普通帖
    user_id = db.Column('user_id',
                        VARCHAR(collation=u'utf8mb4_unicode_ci', length=50),
                        nullable=False)
    forum_id = db.Column('forum_id',
                         mysql.INTEGER(display_width=11),
                         nullable=False)
    last_modify_time = db.Column('last_modify_time',
                                 mysql.BIGINT(display_width=20),
                                 nullable=False)
예제 #25
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('record_sign',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('order_no', sa.String(length=32), server_default='', nullable=False),
    sa.Column('coin_id', sa.String(length=128), server_default='', nullable=False),
    sa.Column('parameter', sa.String(length=512), server_default='', nullable=False),
    sa.Column('sign', sa.TEXT(), nullable=True),
    sa.Column('response', sa.TEXT(), nullable=True),
    sa.Column('do_result', sa.Boolean(), server_default='0', nullable=False),
    sa.PrimaryKeyConstraint('_id'),
    sa.UniqueConstraint('order_no')
    )
    op.create_table('token_node_conf',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('node_env', sa.String(length=16), server_default='dev', nullable=False),
    sa.Column('coin_id', sa.String(length=128), server_default='', nullable=False),
    sa.Column('node_url', sa.String(length=512), server_default='', nullable=False),
    sa.Column('node_port', sa.String(length=16), server_default='', nullable=False),
    sa.Column('server_status', sa.String(length=16), server_default='0', nullable=False),
    sa.Column('script_status', sa.String(length=16), server_default='0', nullable=False),
    sa.Column('mark', sa.String(length=512), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('_id')
    )
    op.alter_column('record_pk', 'address',
               existing_type=mysql.MEDIUMTEXT(collation='utf8_bin'),
               nullable=True)
    op.alter_column('record_pk', 'response',
               existing_type=mysql.MEDIUMTEXT(collation='utf8_bin'),
               nullable=True)
예제 #26
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'stat_event', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('timestamp', sa.DateTime(), nullable=True),
        sa.Column('author_id', sa.Integer(), nullable=True),
        sa.Column('visitor_id', sa.String(length=32), nullable=True),
        sa.Column('ip', sa.String(length=40), nullable=True),
        sa.ForeignKeyConstraint(
            ['author_id'],
            ['users.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.alter_column('comments',
                    'hide',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('friend_link',
                    'hide',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column(
        'friend_link',
        'logo',
        existing_type=mysql.MEDIUMTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=65535),
        existing_nullable=True)
    op.alter_column('messages',
                    'hide',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('post_type',
                    'default',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('posts',
                    'hide',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('roles',
                    'default',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
예제 #27
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cats_1',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('a_name', mysql.TINYTEXT(), nullable=True),
                    sa.Column('a_height', mysql.TINYTEXT(), nullable=True),
                    sa.Column('a_weight', mysql.TINYTEXT(), nullable=True),
                    sa.Column('a_color', mysql.TINYTEXT(), nullable=True),
                    sa.Column('a_detail', mysql.MEDIUMTEXT(), nullable=True),
                    sa.Column('c_eat', mysql.TINYTEXT(), nullable=True),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
예제 #28
0
def upgrade():
    op.add_column(u'user', sa.Column(u'language', sa.Integer()))
    op.add_column(u'position', sa.Column(u'internal_name', sa.String(255)))
    op.create_table('position_rights',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('position_id', sa.Integer(), nullable=True),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('json_data', mysql.MEDIUMTEXT(), nullable=True),
                    sa.Column('role', sa.String(length=64), nullable=True),
                    sa.Column('time_created', sa.DateTime(), nullable=True),
                    sa.Column('time_modified', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_foreign_key(u'position_right_position_fk', 'position_rights',
                          'position', ['position_id'], ['id'])
    op.create_foreign_key(u'position_right_user_fk1', 'position_rights',
                          'user', ['user_id'], ['id'])
    op.create_table('application_event',
                    sa.Column('id', sa.Integer(), primary_key=True),
                    sa.Column('applicant_id', sa.Integer(), nullable=True),
                    sa.Column('application_event_token', sa.String(255)),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('status', sa.Integer()),
                    sa.Column('step', sa.String(255)),
                    sa.Column('time', sa.DateTime()),
                    sa.Column('note', sa.String(255)),
                    sa.Column('time_created', sa.DateTime(), nullable=True),
                    sa.Column('time_modified', sa.DateTime(), nullable=True),
                    sa.Column('duration', sa.Integer()))
    op.create_foreign_key(u'application_event_application_fk',
                          'application_event', 'application', ['applicant_id'],
                          ['id'])
    op.create_foreign_key(u'application_event_user_fk', 'application_event',
                          'user', ['user_id'], ['id'])

    op.create_table('application_feedback',
                    sa.Column('id', sa.Integer(), primary_key=True),
                    sa.Column('application_feedback_token', sa.String(255)),
                    sa.Column('application_id', sa.Integer(), nullable=True),
                    sa.Column('rating_time', sa.DateTime()),
                    sa.Column('rating_message', sa.Text()),
                    sa.Column('time_created', sa.DateTime(), nullable=True),
                    sa.Column('time_modified', sa.DateTime(), nullable=True),
                    sa.Column('rating', sa.Integer()))
    op.create_foreign_key(u'application_feedback_application_fk',
                          'application_feedback', 'application',
                          ['application_id'], ['id'])
def upgrade_production():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'experiment_thing_snapshots',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('experiment_thing_id', sa.String(length=256), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('object_type', sa.Integer(), nullable=True),
        sa.Column('experiment_id', sa.Integer(), nullable=True),
        sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_experiment_thing_snapshots_experiment_id'),
                    'experiment_thing_snapshots', ['experiment_id'],
                    unique=False)
    op.create_index(op.f('ix_experiment_thing_snapshots_experiment_thing_id'),
                    'experiment_thing_snapshots', ['experiment_thing_id'],
                    unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('card_event',
                  sa.Column('title_kr', sa.String(length=100), nullable=True))
    op.add_column('card_event_choice',
                  sa.Column('effect_kr', mysql.MEDIUMTEXT(), nullable=True))
    op.add_column('card_event_choice',
                  sa.Column('title_kr', sa.String(length=100), nullable=True))

    op.execute("""
    UPDATE card_event SET title_kr=title;
    """)
    op.execute("""
    UPDATE card_event_choice SET effect_kr=effect;
    """)
    op.execute("""
    UPDATE card_event_choice SET title_kr=title;
    """)