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'))
Esempio n. 2
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
        ]]
Esempio n. 3
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_mysql():
        op.alter_column('job_step_log',
                        'message',
                        existing_type=mysql.LONGTEXT(),
                        nullable=True)
    elif is_sqlite():
        pass  # Keep cluster options
    else:
        pass  # Keep cluster options
    op.drop_table('cluster_platform')
Esempio n. 4
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_mysql():
        op.execute("""
            ALTER TABLE job CHANGE `type` `type`
                ENUM('APP','BATCH', 'NORMAL')
                CHARSET utf8 COLLATE utf8_general_ci NOT NULL;
            """)
    elif is_sqlite():
        pass # No enum support in sqlite
    else:
        values = ['APP','BATCH','NORMAL']
        all_commands = [[get_psql_enum_alter_commands(['job'], ['type'],
            'JobTypeEnumType', values, 'NORMAL'), 
            None]]
Esempio n. 5
0
def downgrade():
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('name')
            batch_op.drop_column('exception_stack')
    else:
        op.drop_column('job', 'name')
        op.drop_column('job', 'exception_stack')

    if is_mysql():
        op.execute("""
            ALTER TABLE job
                MODIFY status_text TEXT,
                MODIFY source_code TEXT,
                MODIFY workflow_definition TEXT""")
        op.execute("ALTER TABLE job_result MODIFY content TEXT")
        op.execute("ALTER TABLE job_step_log MODIFY message TEXT")
Esempio n. 6
0
def upgrade():
    if is_mysql():
        op.add_column(
            'job', sa.Column('exception_stack',
                             mysql.LONGTEXT(),
                             nullable=True))
        op.execute("""
            ALTER TABLE job
                MODIFY status_text LONGTEXT,
                MODIFY source_code LONGTEXT,
                MODIFY workflow_definition LONGTEXT""")

        op.execute("ALTER TABLE job_result MODIFY content LONGTEXT")
        op.execute("ALTER TABLE job_step_log MODIFY message LONGTEXT")
    else:
        op.add_column('job',
                      sa.Column('exception_stack', sa.Text(), nullable=True))

    op.add_column('job', sa.Column('name', sa.String(length=50),
                                   nullable=True))
    op.execute('UPDATE job SET name = workflow_name')