def upgrade(): # ### commands auto generated by Alembic - please adjust! ### if not is_sqlite(): op.create_foreign_key('attribute_privacy_attribute_id_fk', 'attribute_privacy', 'attribute', ['attribute_id'], ['id'], ondelete='CASCADE') if is_mysql(): op.get_bind().execute(text(""" ALTER TABLE data_source CHANGE COLUMN `format` `format` ENUM( 'CSV', 'CUSTOM', 'GEO_JSON', 'HAR_IMAGE_FOLDER', 'HDF5', 'DATA_FOLDER', 'IMAGE_FOLDER', 'JDBC', 'JSON', 'NETCDF4', 'NPY', 'PARQUET', 'PICKLE', 'SAV', 'SHAPEFILE', 'TAR_IMAGE_FOLDER', 'TEXT', 'VIDEO_FOLDER', 'UNKNOWN', 'XML_FILE') CHARACTER SET 'utf8' NOT NULL ;""")) elif is_psql(): new_ds_values = ['CSV', 'CUSTOM', 'GEO_JSON', 'HAR_IMAGE_FOLDER', 'HDF5', 'DATA_FOLDER', 'IMAGE_FOLDER', 'JDBC', 'JSON', 'NETCDF4', 'NPY', 'PARQUET', 'PICKLE', 'SAV', 'SHAPEFILE', 'TAR_IMAGE_FOLDER', 'TEXT', 'VIDEO_FOLDER', 'UNKNOWN', 'XML_FILE'] all_commands = [[ get_psql_enum_alter_commands(['data_source'], ['format'], 'DataSourceFormatEnumType', new_ds_values, 'CSV'), None ]] upgrade_actions(all_commands)
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 upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'model', sa.Column('deployment_status', sa.Enum('NOT_DEPLOYED', 'ERROR', 'EDITING', 'SAVED', 'RUNNING', 'STOPPED', 'SUSPENDED', 'PENDING', 'DEPLOYED', name='DeploymentStatusEnumType'), nullable=False)) upgrade_actions(get_commands())
def upgrade(): if is_mysql(): op.add_column('data_source', sa.Column('command', mysql.LONGTEXT(), nullable=True)) 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;""" )) elif is_psql(): op.add_column('data_source', sa.Column('command', sa.Text(), nullable=True)) upgrade_actions(get_commands()) if is_sqlite(): with op.batch_alter_table('storage') as batch_op: batch_op.add_column( sa.Column('enabled', sa.Boolean(), nullable=False, server_default='true')) with op.batch_alter_table('data_source') as batch_op: batch_op.add_column( sa.Column('updated', sa.DateTime(), nullable=False, server_default='2021-01-01')) batch_op.add_column(sa.Column('command', sa.Text(), nullable=True)) else: 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'))
def upgrade(): if is_mysql(): op.execute(""" ALTER TABLE `storage` CHANGE `type` `type` ENUM( 'CASSANDRA','ELASTIC_SEARCH','HDFS','HIVE', 'HIVE_WAREHOUSE', 'JDBC', 'KAFKA', 'LOCAL','MONGODB' ) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL;""") elif is_psql(): storage_values = [ 'CASSANDRA', 'ELASTIC_SEARCH', 'HDFS', 'HIVE', 'HIVE_WAREHOUSE', 'JDBC', 'KAFKA', 'LOCAL', 'MONGODB' ] all_commands = [[ get_psql_enum_alter_commands(['storage'], ['type'], 'StorageTypeEnumType', storage_values, 'HDFS'), None ]] upgrade_actions(all_commands)
def upgrade(): upgrade_actions(get_commands())