def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('joined_teams', mysql.LONGTEXT(), nullable=False))
    op.add_column('team', sa.Column('members', mysql.LONGTEXT(), nullable=False))
    op.add_column('team', sa.Column('admins', mysql.LONGTEXT(), nullable=False))
    op.drop_index(op.f('ix_team_member_is_admin'), table_name='team_member')
    op.drop_table('team_member')
Beispiel #2
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('phone', mysql.VARCHAR(length=32), nullable=True))
    op.add_column('user', sa.Column('user_about', mysql.LONGTEXT(), nullable=True))
    op.add_column('user', sa.Column('phone_is_validate', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.alter_column('user', 'is_active',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.alter_column('user', 'email_is_validate',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.drop_column('user', 'about')
    op.alter_column('post', 'visibility',
               existing_type=mysql.VARCHAR(length=16),
               comment=None,
               existing_comment='文章可见性:私密/公开',
               existing_nullable=True)
    op.alter_column('post', 'comments',
               existing_type=mysql.INTEGER(),
               comment=None,
               existing_comment='评论数量',
               existing_nullable=True)
    op.alter_column('post', 'article',
               existing_type=mysql.LONGTEXT(),
               comment=None,
               existing_comment='文章内容',
               existing_nullable=True)
Beispiel #3
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('subscriber',
                    'subscription',
                    existing_type=sa.String(length=1000),
                    type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                        length=100),
                    existing_nullable=False)
    op.alter_column('page_version',
                    'notes',
                    existing_type=sa.Text(length=5000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page_version',
                    'body',
                    existing_type=sa.Text(length=10000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page',
                    'notes',
                    existing_type=sa.Text(length=5000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page',
                    'body',
                    existing_type=sa.Text(length=10000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
Beispiel #4
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        'page',
        'body',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=10000000),
        existing_nullable=True)
    op.alter_column(
        'page',
        'notes',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=5000000),
        existing_nullable=True)
    op.alter_column(
        'page_version',
        'body',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=10000000),
        existing_nullable=True)
    op.alter_column(
        'page_version',
        'notes',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=5000000),
        existing_nullable=True)
    op.add_column('record',
                  sa.Column('action', sa.String(length=150), nullable=False))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "userinfo",
        sa.Column(
            "id", mysql.INTEGER(display_width=11), autoincrement=False, nullable=False
        ),
        sa.Column("username", mysql.TEXT(), nullable=False),
        sa.Column("password", mysql.TEXT(), nullable=False),
        sa.Column("name", mysql.TEXT(), nullable=False),
        sa.Column("avatar", sa.BLOB(), nullable=False),
        sa.Column(
            "favorites",
            mysql.LONGTEXT(charset="utf8mb4", collation="utf8mb4_bin"),
            nullable=False,
        ),
        sa.Column(
            "history",
            mysql.LONGTEXT(charset="utf8mb4", collation="utf8mb4_bin"),
            nullable=False,
        ),
        mysql_default_charset="utf8",
        mysql_engine="InnoDB",
    )
    op.drop_index(op.f("ix_user_username"), table_name="user")
    op.drop_table("user")
Beispiel #6
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'workflow_variable', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=200), nullable=False),
        sa.Column('description', mysql.LONGTEXT(), nullable=True),
        sa.Column('type',
                  sa.Enum('DATETIME',
                          'INTEGER',
                          'BINARY',
                          'TEXT',
                          'FLOAT',
                          'TIMESTAMP',
                          'DATE',
                          'LAT_LONG',
                          'FILE',
                          'TIME',
                          'CHARACTER',
                          'DECIMAL',
                          'ENUM',
                          'LONG',
                          'VECTOR',
                          'DOUBLE',
                          name='DataTypeEnumType'),
                  nullable=False),
        sa.Column('multiplicity', sa.Integer(), nullable=False),
        sa.Column('suggested_widget', sa.String(length=200), nullable=True),
        sa.Column('default_value', mysql.LONGTEXT(), nullable=True),
        sa.Column('workflow_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['workflow_id'],
            ['workflow.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.drop_index('fk_task_group_id', table_name='task')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'platform_plugin', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=200), nullable=False),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('version', sa.String(length=200), nullable=True),
        sa.Column('copyright', sa.String(length=200), nullable=True),
        sa.Column('status',
                  sa.Enum('OUTDATED',
                          'DISABLED',
                          'ERROR',
                          'PENDING',
                          'INSTALLED',
                          name='PluginStatusEnumType'),
                  nullable=True),
        sa.Column('message', mysql.LONGTEXT(), nullable=True),
        sa.Column('manifest', mysql.LONGTEXT(), nullable=True),
        sa.Column('ids_offset', sa.Integer(), nullable=False),
        sa.Column('uuid', sa.String(length=200), nullable=False),
        sa.Column('url', sa.String(length=200), nullable=True),
        sa.Column('use_compiler', sa.Boolean(), nullable=False),
        sa.Column('use_executor', sa.Boolean(), nullable=False),
        sa.Column('platform_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['platform_id'],
            ['platform.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.add_column('platform', sa.Column('plugin', sa.Boolean(),
                                        nullable=False))
    op.add_column('platform',
                  sa.Column('version', sa.String(length=200), nullable=True))
    op.drop_column('workflow', 'publishing_enabled')
Beispiel #8
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('product', 'ghost_link')
    op.alter_column('page_version', 'sidebar',
               existing_type=sa.String(length=5000),
               type_=mysql.TEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('page_version', 'notes',
               existing_type=sa.Text(length=5000000),
               type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('page_version', 'body',
               existing_type=sa.Text(length=10000000),
               type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('page', 'sidebar',
               existing_type=sa.String(length=5000),
               type_=mysql.TEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('page', 'notes',
               existing_type=sa.Text(length=5000000),
               type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('page', 'body',
               existing_type=sa.Text(length=10000000),
               type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
               existing_nullable=True)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('record',
                    'minutes',
                    existing_type=sa.Float(),
                    type_=mysql.INTEGER(display_width=11),
                    existing_nullable=True)
    op.alter_column('page_version',
                    'notes',
                    existing_type=sa.Text(length=5000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page_version',
                    'body',
                    existing_type=sa.Text(length=10000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page',
                    'notes',
                    existing_type=sa.Text(length=5000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
    op.alter_column('page',
                    'body',
                    existing_type=sa.Text(length=10000000),
                    type_=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
                    existing_nullable=True)
Beispiel #10
0
def upgrade():
    engine = op.get_bind()
    if engine.dialect.dialect_description.startswith('mysql'):
        with op.batch_alter_table('session') as batch_op:
            batch_op.alter_column('description', type_=sa_mysql.LONGTEXT())
        with op.batch_alter_table('environment') as batch_op:
            batch_op.alter_column('description', type_=sa_mysql.LONGTEXT())
        with op.batch_alter_table('environment-template') as batch_op:
            batch_op.alter_column('description', type_=sa_mysql.LONGTEXT())
Beispiel #11
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('bugs',
                    'replys',
                    existing_type=mysql.LONGTEXT(),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞评论')
    op.alter_column('bugs',
                    'wybug_author',
                    existing_type=mysql.VARCHAR(length=50),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞作者')
    op.alter_column('bugs',
                    'wybug_date',
                    existing_type=mysql.VARCHAR(length=50),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞提交时间')
    op.alter_column('bugs',
                    'wybug_detail',
                    existing_type=mysql.LONGTEXT(),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞详情')
    op.alter_column('bugs',
                    'wybug_id',
                    existing_type=mysql.VARCHAR(length=50),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞编号')
    op.alter_column('bugs',
                    'wybug_level',
                    existing_type=mysql.VARCHAR(length=20),
                    nullable=False,
                    comment=None,
                    existing_comment='危害等级')
    op.alter_column('bugs',
                    'wybug_reply',
                    existing_type=mysql.LONGTEXT(),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞回应')
    op.alter_column('bugs',
                    'wybug_title',
                    existing_type=mysql.VARCHAR(length=150),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞标题')
    op.alter_column('bugs',
                    'wybug_type',
                    existing_type=mysql.VARCHAR(length=50),
                    nullable=False,
                    comment=None,
                    existing_comment='漏洞类型')
    op.drop_index('bugs_wybug_id', table_name='bugs')
Beispiel #12
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'comment', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('name', sa.String(length=100), nullable=False),
        sa.Column('email', sa.String(length=150), nullable=True),
        sa.Column('body', sa.String(length=5000), nullable=False),
        sa.Column('reaction', sa.String(length=50), nullable=True),
        sa.Column('rating', sa.Integer(), nullable=True),
        sa.Column('reply_id', sa.Integer(), nullable=True),
        sa.Column('page_id', sa.Integer(), nullable=True),
        sa.Column('product_id', sa.Integer(), nullable=True),
        sa.Column('ip', sa.String(length=40), nullable=False),
        sa.Column('session_id', sa.String(length=200), nullable=True),
        sa.Column('created', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ['page_id'],
            ['page.id'],
        ), sa.ForeignKeyConstraint(
            ['product_id'],
            ['product.id'],
        ), sa.ForeignKeyConstraint(
            ['reply_id'],
            ['comment.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.alter_column(
        'page',
        'body',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=10000000),
        existing_nullable=True)
    op.alter_column(
        'page',
        'notes',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=5000000),
        existing_nullable=True)
    op.alter_column(
        'page_version',
        'body',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=10000000),
        existing_nullable=True)
    op.alter_column(
        'page_version',
        'notes',
        existing_type=mysql.LONGTEXT(collation='utf8mb4_unicode_ci'),
        type_=sa.Text(length=5000000),
        existing_nullable=True)
    op.add_column('user',
                  sa.Column('name', sa.String(length=100), nullable=True))
Beispiel #13
0
def do_upgrade():
    try:
        op.alter_column(u'bibrec',
                        'additional_info',
                        existing_type=mysql.TEXT(),
                        type_=mysql.LONGTEXT(),
                        nullable=True)
    except OperationalError:
        op.add_column(
            'bibrec',
            sa.Column('additional_info', mysql.LONGTEXT(), nullable=True))
Beispiel #14
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'reports', sa.Column('report_id', sa.Integer(), nullable=False),
        sa.Column('original_text', mysql.LONGTEXT(), nullable=True),
        sa.Column('original_language', mysql.TEXT(), nullable=True),
        sa.Column('translated_text', mysql.LONGTEXT(), nullable=True),
        sa.Column('category', mysql.TEXT(), nullable=True),
        sa.Column('radlex_annotations', mysql.LONGTEXT(), nullable=True),
        sa.Column('creation_date', sa.DateTime(timezone=True), nullable=True),
        sa.PrimaryKeyConstraint('report_id'))
Beispiel #15
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('metric_value',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('sent_time', sa.DateTime(), nullable=True),
    sa.Column('time', sa.DateTime(), nullable=False),
    sa.Column('probe_id', sa.Integer(), nullable=False),
    sa.Column('resource_id', sa.Integer(), nullable=False),
    sa.Column('data', mysql.LONGTEXT(), nullable=False),
    sa.Column('tma_data', mysql.LONGTEXT(), nullable=True),
    sa.Column('item', sa.String(length=200), nullable=True),
    sa.Column('sent', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              nullable=False),
                    sa.Column('username',
                              mysql.VARCHAR(length=80),
                              nullable=False),
                    sa.Column('email',
                              mysql.VARCHAR(length=120),
                              nullable=False),
                    sa.Column('obj',
                              mysql.LONGTEXT(charset=u'utf8mb4',
                                             collation=u'utf8mb4_bin'),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'utf8mb4',
                    mysql_engine=u'InnoDB')
    op.create_table('post',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              nullable=False),
                    sa.Column('date', sa.DATE(), nullable=True),
                    sa.Column('content',
                              mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('category',
                              mysql.VARCHAR(length=20),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'utf8mb4',
                    mysql_engine=u'InnoDB')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_mysql():
        parameters_col = sa.Column('parameters',
                                   mysql.LONGTEXT(),
                                   nullable=False)

        op.execute(
            "ALTER TABLE `stand`.`job_result` CHANGE `type` `type` "
            "ENUM('VISUALIZATION','HTML','TEXT','OTHER','MODEL','METRIC')")
    else:
        parameters_col = sa.Column('parameters', sa.Text(), nullable=False)

        values = ['VISUALIZATION', 'HTML', 'TEXT', 'OTHER', 'MODEL', 'METRIC']
        all_commands = [[
            get_psql_enum_alter_commands(['job_result'], ['type'],
                                         'ResultTypeEnumType', values, 'TEXT'),
            None
        ]]

    op.create_table(
        'cluster_flavor', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=200), nullable=False),
        sa.Column('enabled', sa.String(length=200), nullable=False),
        parameters_col, sa.Column('cluster_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['cluster_id'],
            ['cluster.id'],
        ), sa.PrimaryKeyConstraint('id'))
def upgrade():
    op.add_column('data_source',
                  sa.Column('command', mysql.LONGTEXT(), nullable=True))
    op.get_bind().execute(
        text(
            "ALTER TABLE `limonero`.`data_source` CHANGE `format` `format` "
            "ENUM('XML_FILE','NETCDF4','HDF5','SHAPEFILE','TEXT','CUSTOM','JSON',"
            "'CSV','PICKLE','GEO_JSON','JDBC') CHARSET utf8 "
            "COLLATE utf8_unicode_ci NOT NULL;"))
    op.get_bind().execute(
        text("""
        ALTER TABLE storage CHANGE `type` `type` 
        ENUM('HDFS', 'OPHIDIA','ELASTIC_SEARCH','MONGODB',
             'POSTGIS','HBASE','CASSANDRA','JDBC') CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL;"""
             ))
    op.add_column(
        'storage',
        sa.Column('enabled',
                  sa.Boolean(),
                  nullable=False,
                  server_default=sa.schema.DefaultClause("1"),
                  default=1))
    op.add_column(
        'data_source',
        sa.Column('updated',
                  sa.DateTime(),
                  nullable=False,
                  server_default='2018-01-01'))
Beispiel #19
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('ascii_table',
                    sa.Column('title', sa.String(length=512), nullable=False),
                    sa.Column('art', mysql.LONGTEXT(), nullable=True),
                    sa.Column('date_created', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('title'))
Beispiel #20
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_track_artist'), table_name='track')
    op.alter_column('page',
                    'content',
                    existing_type=mysql.LONGTEXT(),
                    nullable=True)
Beispiel #21
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('page',
                    'content',
                    existing_type=mysql.LONGTEXT(),
                    nullable=False)
    op.create_index(op.f('ix_track_artist'), 'track', ['artist'], unique=False)
Beispiel #22
0
class Instance(db.Model):
    id = db.Column(db.BigInteger, primary_key=True)
    package_id = db.Column(db.BigInteger,
                           db.ForeignKey('package.id'),
                           nullable=False)
    hash = db.Column(db.String(64), nullable=False)

    created_at = db.Column(db.DateTime,
                           default=db.func.utc_timestamp(),
                           nullable=False)
    created_by = db.Column(USERNAME_TYPE, nullable=False)
    updated_at = db.Column(db.DateTime,
                           default=db.func.utc_timestamp(),
                           onupdate=db.func.utc_timestamp(),
                           nullable=False)
    updated_by = db.Column(USERNAME_TYPE, nullable=False)

    # Contents can be a potentially large JSON blob, so store it as
    # LONGTEXT rather than VARCHAR, and load lazily.
    contents = deferred(
        db.Column(mysql.LONGTEXT(collation=UTF8_BIN), nullable=False))

    package = db.relationship('Package', back_populates='instances')
    versions = db.relationship('Version', back_populates='instance')
    tags = db.relationship('Tag', back_populates='instance')
    blobs = db.relationship('S3Blob', secondary=InstanceBlobAssoc)
Beispiel #23
0
def upgrade(migrate_engine):
    if migrate_engine.name != 'mysql':
        return

    meta = sqlalchemy.MetaData(bind=migrate_engine)
    raw_template = sqlalchemy.Table('raw_template', meta, autoload=True)
    raw_template.c.template.alter(type=mysql.LONGTEXT())
Beispiel #24
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('storage', sa.Column('client_url', sa.String(length=1000), nullable=True))
    if is_mysql():    
        op.add_column('storage', sa.Column('extra_params', mysql.LONGTEXT(), nullable=True))
        op.add_column('data_source', sa.Column('is_lookup', sa.Boolean(), nullable=False, 
            server_default='0'))
    else:
        op.add_column('storage', sa.Column('extra_params', sa.Text(), nullable=True))
        op.add_column('data_source', sa.Column('is_lookup', sa.Boolean(), nullable=False, 
            server_default='false'))

    if is_mysql():
        op.execute("""
            ALTER TABLE `storage` CHANGE `type` `type` ENUM(
                'CASSANDRA','ELASTIC_SEARCH','HDFS','HIVE', 'HIVE_WAREHOUSE',
                 'JDBC','LOCAL','MONGODB'
                ) CHARSET utf8 COLLATE
                utf8_unicode_ci NOT NULL;""")
    elif is_psql():
        storage_values = ['CASSANDRA','ELASTIC_SEARCH','HDFS',
                'HIVE', 'HIVE_WAREHOUSE', 'JDBC','LOCAL','MONGODB']
        all_commands = [
            [
                get_psql_enum_alter_commands(['storage'], ['type'],
                    'StorageTypeEnumType', storage_values, 'HDFS'),
                None
            ]
        ]
        upgrade_actions(all_commands)
def do_upgrade():
    """Do upgrade."""
    op.alter_column(u'remoteACCOUNT',
                    'extra_data',
                    existing_type=mysql.TEXT(),
                    type_=mysql.LONGTEXT(),
                    nullable=True)
Beispiel #26
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('global_settings', 'events_per_page')
    op.alter_column('event',
                    'description',
                    existing_type=mysql.LONGTEXT(),
                    nullable=True)
Beispiel #27
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('job_step_log',
                    'message',
                    existing_type=mysql.LONGTEXT(),
                    nullable=True)
    op.drop_table('cluster_platform')
Beispiel #28
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cluster_platform',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('platform_id', sa.Integer(), nullable=False),
                    sa.Column('cluster_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['cluster_id'],
                        ['cluster.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    if is_mysql():
        op.alter_column('job_step_log',
                        'message',
                        existing_type=mysql.LONGTEXT(),
                        nullable=False)
        op.execute("""
            ALTER TABLE cluster CHANGE `type` `type`
                ENUM('MESOS','YARN','SPARK_LOCAL','KUBERNETES')
                CHARSET utf8 COLLATE utf8_general_ci NOT NULL;
            """)
    elif is_sqlite():
        pass  # No enum support in sqlite
    else:
        op.alter_column('job_step_log',
                        'message',
                        existing_type=sa.Text(),
                        nullable=False)
        values = ['MESOS', 'YARN', 'SPARK_LOCAL', 'KUBERNETES']
        all_commands = [[
            get_psql_enum_alter_commands(['cluster'], ['type'],
                                         'ClusterTypeEnumType', values,
                                         'SPARK_LOCAL'), None
        ]]
Beispiel #29
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
        }
def upgrade(migrate_engine):
    if migrate_engine.name != 'mysql':
        return

    meta = sqlalchemy.MetaData(bind=migrate_engine)

    stack = sqlalchemy.Table('stack', meta, autoload=True)
    stack.c.parameters.alter(type=mysql.LONGTEXT())

    resource = sqlalchemy.Table('resource', meta, autoload=True)
    resource.c.rsrc_metadata.alter(type=mysql.LONGTEXT())

    watch_rule = sqlalchemy.Table('watch_rule', meta, autoload=True)
    watch_rule.c.rule.alter(type=mysql.LONGTEXT())

    watch_data = sqlalchemy.Table('watch_data', meta, autoload=True)
    watch_data.c.data.alter(type=mysql.LONGTEXT())