def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('job', sa.Column('creator', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True, comment='创建人'), sa.Column('creatTime', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True, comment='创建时间'), sa.Column('reviseTime', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True, comment='更新时间'), sa.Column('reviser', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True, comment='修改人'), sa.Column('isDel', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=True, comment='是否删除 1-删除 0-未删除'), sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False), sa.Column('tittle', mysql.VARCHAR(length=50), nullable=True, comment='工作的标题'), sa.Column('reward', mysql.VARCHAR(length=20), nullable=True, comment='报酬'), sa.Column('place', mysql.VARCHAR(length=20), nullable=True, comment='地点'), sa.Column('settlement', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False, comment='工作结算方式 1-日结 2-周结 3-完工结'), sa.Column('isBagEating', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False, comment='是否包吃 1-是 2-否'), sa.Column('encase', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False, comment='是否包住 1-是 2-否'), sa.Column('isTrafficSubsidy', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False, comment='是否有交通补贴 1-是 2-否'), sa.Column('royalty', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False, comment='是否有提成 1-是 2-否'), sa.PrimaryKeyConstraint('id'), comment=' 工作表', mysql_comment=' 工作表', mysql_default_charset='utf8', mysql_engine='InnoDB') op.drop_table('myjob')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('table_makanan', 'harga', existing_type=mysql.INTEGER(display_width=11), nullable=False)
def downgrade_flask_state_sqlite(): op.create_table( "flask_state_io_dg_tmp", sa.Column("id", mysql.INTEGER(unsigned=True), autoincrement=True, nullable=False), sa.Column("create_time", mysql.DATETIME(), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=True), sa.Column("update_time", mysql.DATETIME(), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=True), sa.Column("cpu", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("memory", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("load_avg", sa.String(length=32), server_default="", nullable=True), sa.Column("disk_usage", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("boot_seconds", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("ts", mysql.BIGINT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("used_memory", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("used_memory_rss", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("connected_clients", mysql.SMALLINT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("uptime_in_seconds", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("mem_fragmentation_ratio", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("keyspace_hits", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("keyspace_misses", mysql.INTEGER(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("hits_ratio", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.Column("delta_hits_ratio", mysql.FLOAT(unsigned=True), server_default=sa.text("0"), nullable=True), sa.PrimaryKeyConstraint("id"), ) op.execute( "insert into flask_state_io_dg_tmp(id, create_time, update_time, cpu, memory, load_avg, disk_usage, boot_seconds, ts, used_memory, used_memory_rss, connected_clients, uptime_in_seconds, mem_fragmentation_ratio, keyspace_hits, keyspace_misses, hits_ratio, delta_hits_ratio) select id, create_time, update_time, cpu, memory, load_avg, disk_usage, boot_seconds, ts, used_memory, used_memory_rss, connected_clients, uptime_in_seconds, mem_fragmentation_ratio, keyspace_hits, keyspace_misses, hits_ratio, delta_hits_ratio from flask_state_io;" ) op.drop_table("flask_state_io") op.rename_table("flask_state_io_dg_tmp", "flask_state_io") op.create_index("idx_ts", "flask_state_io", [sa.text("ts DESC")], unique=False)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('products', sa.Column('cantity', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False)) op.drop_column('products', 'quantity')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('article', 'article_class', existing_type=mysql.INTEGER(display_width=11), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'team_members', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'team_members', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'submitted_applications', sa.Column('grant_application_id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) op.drop_column('submitted_applications', 'grant_num_id') op.add_column( 'researcher_profile', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'researcher_profile', sa.Column('login_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( 'researcher_profile', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column('researcher_profile', sa.Column('email', mysql.VARCHAR(length=80), nullable=True)) op.drop_constraint(None, 'researcher_profile', type_='foreignkey') op.drop_column('researcher_profile', 'users') op.add_column( 'researcher_education', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'researcher_education', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.drop_column('researcher_education', 'location') op.add_column( 'publications', sa.Column('grant_num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( 'publications', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'publications', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.drop_constraint(None, 'publications', type_='foreignkey') op.drop_column('publications', 'grant_reference') op.add_column( 'professional_socities', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'professional_socities', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'presentations', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'presentations', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.drop_constraint(None, 'presentations', type_='foreignkey') op.drop_column('presentations', 'grant_reference') op.add_column( 'non_academic_collaborations', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'non_academic_collaborations', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'non_academic_collaborations', sa.Column('grant_number', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_constraint(None, 'non_academic_collaborations', type_='foreignkey') op.drop_column('non_academic_collaborations', 'institution_name') op.drop_column('non_academic_collaborations', 'grant_reference') op.add_column( 'innovations', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'innovations', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'innovations', sa.Column('grant_number', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_constraint(None, 'innovations', type_='foreignkey') op.drop_column('innovations', 'grant_reference') op.add_column( 'impacts', sa.Column('primary_attribution', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( 'impacts', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'impacts', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.drop_constraint(None, 'impacts', type_='foreignkey') op.drop_column('impacts', 'grant_reference') op.add_column( 'funding_ratio', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'funding_ratio', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'funding_diversifications', sa.Column('primary_attribution', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( 'funding_diversifications', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'funding_diversifications', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.drop_constraint(None, 'funding_diversifications', type_='foreignkey') op.drop_column('funding_diversifications', 'grant_reference') op.add_column('engagements', sa.Column('l_name', mysql.VARCHAR(length=64), nullable=True)) op.add_column( 'engagements', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'engagements', sa.Column('login_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( 'engagements', sa.Column('job_title', mysql.VARCHAR(length=4), nullable=True)) op.add_column( 'engagements', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column('engagements', sa.Column('f_name', mysql.VARCHAR(length=64), nullable=True)) op.add_column( 'engagements', sa.Column('ORCID', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column('engagements', sa.Column('email', mysql.VARCHAR(length=80), nullable=True)) op.drop_constraint(None, 'engagements', type_='foreignkey') op.drop_column('engagements', 'target_area') op.drop_column('engagements', 'start_date') op.drop_column('engagements', 'project_topic') op.drop_column('engagements', 'project_name') op.drop_column('engagements', 'grant_application') op.drop_column('engagements', 'end_date') op.drop_column('engagements', 'activity_type') op.add_column( 'employment_db', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'employment_db', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'conferences', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'conferences', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'communication', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'communication', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'awards_db', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'awards_db', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'academic_collaborations', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'academic_collaborations', sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True)) op.add_column( 'academic_collaborations', sa.Column('grant_number', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_constraint(None, 'academic_collaborations', type_='foreignkey') op.drop_column('academic_collaborations', 'grant_reference')
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'parking_lot_detail', type_='foreignkey') op.drop_column('parking_lot_detail', 'parking_lot_id') op.add_column('parking_lot', sa.Column('parking_lot_detail_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.create_foreign_key('parking_lot_ibfk_1', 'parking_lot', 'parking_lot_detail', ['parking_lot_detail_id'], ['id'])
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( u'products_thumbnail', sa.Column('thumbnail_status', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('limit_end_time_price', mysql.DATETIME(), nullable=True)) op.add_column( u'products', sa.Column('promote_price', mysql.DECIMAL(precision=10, scale=2), nullable=True)) op.add_column( u'products', sa.Column('excellent', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('limit_start_time_price', mysql.DATETIME(), nullable=True)) op.add_column( u'products', sa.Column('vip_price', mysql.DECIMAL(precision=10, scale=2), nullable=True)) op.add_column( u'products', sa.Column('buy_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('integral', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('new_goods', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('hot_goods', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('view_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'products', sa.Column('sort', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_column(u'products', 'limit_time_price') op.drop_table('goods_thumbnail') op.drop_index(op.f('ix_goods_seller_id'), table_name='goods') op.drop_index(op.f('ix_goods_id_md5'), table_name='goods') op.drop_table('goods')
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('ballot', 'is_provisional') op.create_table('result', sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), sa.Column('poll_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.Column('team_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.Column('score', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.Column('onevotes', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['poll_id'], [u'poll.id'], name=u'result_ibfk_1', ondelete=u'CASCADE'), sa.ForeignKeyConstraint(['team_id'], [u'team.id'], name=u'result_ibfk_2'), sa.PrimaryKeyConstraint('id'), mysql_default_charset=u'utf8', mysql_engine=u'InnoDB') ### end Alembic commands ### # need to re-add old results on downgrade result_table = table('result', sa.Column('id', sa.Integer(), nullable=False), sa.Column('poll_id', sa.Integer(), nullable=True), sa.Column('team_id', sa.Integer(), nullable=True), sa.Column('score', sa.Integer(), nullable=True), sa.Column('onevotes', sa.Integer(), nullable=True)) op.bulk_insert(result_table, [{ 'id': 1, 'poll_id': 1, 'team_id': 87, 'score': 791, 'onevotes': 26 }, { 'id': 2, 'poll_id': 1, 'team_id': 344, 'score': 752, 'onevotes': 5 }, { 'id': 3, 'poll_id': 1, 'team_id': 11, 'score': 712, 'onevotes': 1 }, { 'id': 4, 'poll_id': 1, 'team_id': 331, 'score': 664, 'onevotes': 0 }, { 'id': 5, 'poll_id': 1, 'team_id': 149, 'score': 663, 'onevotes': 0 }, { 'id': 6, 'poll_id': 1, 'team_id': 165, 'score': 614, 'onevotes': 0 }, { 'id': 7, 'poll_id': 1, 'team_id': 75, 'score': 599, 'onevotes': 0 }, { 'id': 8, 'poll_id': 1, 'team_id': 330, 'score': 597, 'onevotes': 0 }, { 'id': 9, 'poll_id': 1, 'team_id': 317, 'score': 511, 'onevotes': 0 }, { 'id': 10, 'poll_id': 1, 'team_id': 132, 'score': 493, 'onevotes': 0 }, { 'id': 11, 'poll_id': 1, 'team_id': 125, 'score': 475, 'onevotes': 0 }, { 'id': 12, 'poll_id': 1, 'team_id': 244, 'score': 444, 'onevotes': 0 }, { 'id': 13, 'poll_id': 1, 'team_id': 273, 'score': 391, 'onevotes': 0 }, { 'id': 14, 'poll_id': 1, 'team_id': 166, 'score': 352, 'onevotes': 0 }, { 'id': 15, 'poll_id': 1, 'team_id': 64, 'score': 332, 'onevotes': 0 }, { 'id': 16, 'poll_id': 1, 'team_id': 52, 'score': 313, 'onevotes': 0 }, { 'id': 17, 'poll_id': 1, 'team_id': 61, 'score': 277, 'onevotes': 0 }, { 'id': 18, 'poll_id': 1, 'team_id': 187, 'score': 262, 'onevotes': 0 }, { 'id': 19, 'poll_id': 1, 'team_id': 194, 'score': 239, 'onevotes': 0 }, { 'id': 20, 'poll_id': 1, 'team_id': 296, 'score': 192, 'onevotes': 0 }, { 'id': 21, 'poll_id': 1, 'team_id': 329, 'score': 140, 'onevotes': 0 }, { 'id': 22, 'poll_id': 1, 'team_id': 209, 'score': 98, 'onevotes': 0 }, { 'id': 23, 'poll_id': 1, 'team_id': 207, 'score': 98, 'onevotes': 0 }, { 'id': 24, 'poll_id': 1, 'team_id': 238, 'score': 76, 'onevotes': 0 }, { 'id': 25, 'poll_id': 1, 'team_id': 306, 'score': 68, 'onevotes': 0 }, { 'id': 26, 'poll_id': 1, 'team_id': 104, 'score': 61, 'onevotes': 0 }, { 'id': 27, 'poll_id': 1, 'team_id': 136, 'score': 55, 'onevotes': 0 }, { 'id': 28, 'poll_id': 1, 'team_id': 270, 'score': 25, 'onevotes': 0 }, { 'id': 29, 'poll_id': 1, 'team_id': 21, 'score': 24, 'onevotes': 0 }, { 'id': 30, 'poll_id': 1, 'team_id': 219, 'score': 20, 'onevotes': 0 }, { 'id': 31, 'poll_id': 1, 'team_id': 253, 'score': 13, 'onevotes': 0 }, { 'id': 32, 'poll_id': 1, 'team_id': 237, 'score': 13, 'onevotes': 0 }, { 'id': 33, 'poll_id': 1, 'team_id': 110, 'score': 11, 'onevotes': 0 }, { 'id': 34, 'poll_id': 1, 'team_id': 210, 'score': 6, 'onevotes': 0 }, { 'id': 35, 'poll_id': 1, 'team_id': 124, 'score': 4, 'onevotes': 0 }, { 'id': 36, 'poll_id': 1, 'team_id': 98, 'score': 3, 'onevotes': 0 }, { 'id': 37, 'poll_id': 1, 'team_id': 213, 'score': 3, 'onevotes': 0 }, { 'id': 38, 'poll_id': 1, 'team_id': 280, 'score': 2, 'onevotes': 0 }, { 'id': 39, 'poll_id': 1, 'team_id': 133, 'score': 2, 'onevotes': 0 }, { 'id': 40, 'poll_id': 1, 'team_id': 188, 'score': 1, 'onevotes': 0 }, { 'id': 41, 'poll_id': 1, 'team_id': 276, 'score': 1, 'onevotes': 0 }])
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('miembros', 'id_grupocasero', existing_type=mysql.INTEGER(display_width=11), nullable=False)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('auth_group', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=80), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('name', 'auth_group', ['name'], unique=True) op.create_table( 'app01_author_book', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('author_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('book_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['author_id'], ['app01_author.id'], name='app01_author_book_author_id_0f6c5f17_fk_app01_author_id'), sa.ForeignKeyConstraint( ['book_id'], ['app01_book.id'], name='app01_author_book_book_id_15e32827_fk_app01_book_id'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('app01_author_book_author_id_2a845453_uniq', 'app01_author_book', ['author_id', 'book_id'], unique=True) op.create_table('sql_user', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=32), nullable=False), sa.Column('depart_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['depart_id'], ['depart.id'], name='sql_user_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('ix_sql_user_name', 'sql_user', ['name'], unique=False) op.create_table( 'auth_permission', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=255), nullable=False), sa.Column('content_type_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('codename', mysql.VARCHAR(length=100), nullable=False), sa.ForeignKeyConstraint( ['content_type_id'], ['django_content_type.id'], name='auth_permission_content_type_id_2f476e4b_fk_django_co'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('auth_permission_content_type_id_codename_01ab375a_uniq', 'auth_permission', ['content_type_id', 'codename'], unique=True) op.create_table( 'auth_user_user_permissions', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('permission_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['permission_id'], ['auth_permission.id'], name='auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm'), sa.ForeignKeyConstraint( ['user_id'], ['auth_user.id'], name='auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id' ), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index( 'auth_user_user_permissions_user_id_permission_id_14a6b632_uniq', 'auth_user_user_permissions', ['user_id', 'permission_id'], unique=True) op.create_table('django_migrations', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('app', mysql.VARCHAR(length=255), nullable=False), sa.Column('name', mysql.VARCHAR(length=255), nullable=False), sa.Column('applied', mysql.DATETIME(fsp=6), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table( 'auth_user_groups', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('group_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['group_id'], ['auth_group.id'], name='auth_user_groups_group_id_97559544_fk_auth_group_id'), sa.ForeignKeyConstraint( ['user_id'], ['auth_user.id'], name='auth_user_groups_user_id_6a12ed8b_fk_auth_user_id'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('auth_user_groups_user_id_group_id_94350c0c_uniq', 'auth_user_groups', ['user_id', 'group_id'], unique=True) op.create_table('depart', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('title', mysql.VARCHAR(length=32), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('ix_depart_title', 'depart', ['title'], unique=False) op.create_table('users', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(charset='utf8', collation='utf8_bin', length=32), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table( 'django_admin_log', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('action_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('object_id', mysql.LONGTEXT(), nullable=True), sa.Column('object_repr', mysql.VARCHAR(length=200), nullable=False), sa.Column('action_flag', mysql.SMALLINT(display_width=5, unsigned=True), autoincrement=False, nullable=False), sa.Column('change_message', mysql.LONGTEXT(), nullable=False), sa.Column('content_type_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['content_type_id'], ['django_content_type.id'], name='django_admin_log_content_type_id_c4bce8eb_fk_django_co'), sa.ForeignKeyConstraint( ['user_id'], ['auth_user.id'], name='django_admin_log_user_id_c564eba6_fk_auth_user_id'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('django_session', sa.Column('session_key', mysql.VARCHAR(length=40), nullable=False), sa.Column('session_data', mysql.LONGTEXT(), nullable=False), sa.Column('expire_date', mysql.DATETIME(fsp=6), nullable=False), sa.PrimaryKeyConstraint('session_key'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('django_session_expire_date_a5c62663', 'django_session', ['expire_date'], unique=False) op.create_table('django_content_type', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('app_label', mysql.VARCHAR(length=100), nullable=False), sa.Column('model', mysql.VARCHAR(length=100), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('django_content_type_app_label_model_76bd3d3b_uniq', 'django_content_type', ['app_label', 'model'], unique=True) op.create_table( 'app01_book', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=64), nullable=False), sa.Column('publisher_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('create_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('modify_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('price', mysql.DECIMAL(precision=5, scale=2), nullable=False), sa.ForeignKeyConstraint( ['publisher_id'], ['app01_publisher.id'], name='app01_book_publisher_id_e407867a_fk_app01_publisher_id'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('name', 'app01_book', ['name'], unique=True) op.create_table('auth_user', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('password', mysql.VARCHAR(length=128), nullable=False), sa.Column('last_login', mysql.DATETIME(fsp=6), nullable=True), sa.Column('is_superuser', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False), sa.Column('username', mysql.VARCHAR(length=150), nullable=False), sa.Column('first_name', mysql.VARCHAR(length=30), nullable=False), sa.Column('last_name', mysql.VARCHAR(length=30), nullable=False), sa.Column('email', mysql.VARCHAR(length=254), nullable=False), sa.Column('is_staff', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False), sa.Column('is_active', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False), sa.Column('date_joined', mysql.DATETIME(fsp=6), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('username', 'auth_user', ['username'], unique=True) op.create_table('app01_publisher', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=64), nullable=False), sa.Column('create_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('modify_time', mysql.DATETIME(fsp=6), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('name', 'app01_publisher', ['name'], unique=True) op.create_table( 'auth_group_permissions', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('group_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('permission_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['group_id'], ['auth_group.id'], name='auth_group_permissions_group_id_b120cbf9_fk_auth_group_id'), sa.ForeignKeyConstraint( ['permission_id'], ['auth_permission.id'], name='auth_group_permissio_permission_id_84c5c92e_fk_auth_perm'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index( 'auth_group_permissions_group_id_permission_id_0cd325b0_uniq', 'auth_group_permissions', ['group_id', 'permission_id'], unique=True) op.create_table( 'app01_author', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(length=64), nullable=False), sa.Column('create_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('modify_time', mysql.DATETIME(fsp=6), nullable=False), sa.Column('detail_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( ['detail_id'], ['app01_authordetail.id'], name='app01_author_detail_id_87f03617_fk_app01_authordetail_id'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('name', 'app01_author', ['name'], unique=True) op.create_index('detail_id', 'app01_author', ['detail_id'], unique=True) op.create_table('app01_authordetail', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('addr', mysql.VARCHAR(length=128), nullable=False), sa.Column('language', mysql.VARCHAR(length=64), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('app01_userinfo', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('username', mysql.VARCHAR(length=32), nullable=False), sa.Column('password', mysql.VARCHAR(length=64), nullable=False), sa.Column('email', mysql.VARCHAR(length=32), nullable=True), sa.Column('avatar', mysql.VARCHAR(length=100), nullable=True), sa.Column('gender', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('username', 'app01_userinfo', ['username'], unique=True) op.drop_table('flask_userinfo')
def downgrade(): op.drop_constraint(None, 'yara_query_result', type_='foreignkey') op.alter_column('yara_query_result', 'component_shard_id', existing_type=mysql.INTEGER(display_width=11), nullable=False) op.drop_column('yara_query_result', 'component_id')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( u'surveys', sa.Column('building_type_other', mysql.VARCHAR(length=100), nullable=True)) op.add_column( u'surveys', sa.Column('num_occupants', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'surveys', sa.Column('householder_actions', mysql.TEXT(), nullable=True)) op.add_column( u'surveys', sa.Column('renewable_contribution_pre', mysql.FLOAT(), nullable=True)) op.add_column(u'surveys', sa.Column('follow_up_3_date', sa.DATE(), nullable=True)) op.add_column(u'surveys', sa.Column('follow_up_1_date', sa.DATE(), nullable=True)) op.add_column(u'surveys', sa.Column('solid_annual_pre', mysql.FLOAT(), nullable=True)) op.add_column(u'surveys', sa.Column('faults_identified', mysql.TEXT(), nullable=True)) op.add_column(u'surveys', sa.Column('follow_up_2_date', sa.DATE(), nullable=True)) op.add_column( u'surveys', sa.Column('building_construction_other', mysql.VARCHAR(length=100), nullable=True)) op.add_column( u'surveys', sa.Column('building_age', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column( u'surveys', sa.Column('householder_comments', mysql.TEXT(), nullable=True)) op.add_column(u'surveys', sa.Column('gas_annual_pre', mysql.FLOAT(), nullable=True)) op.add_column( u'surveys', sa.Column('follow_up_2_complete', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) op.add_column(u'surveys', sa.Column('surveyor_comments', mysql.TEXT(), nullable=True)) op.add_column( u'surveys', sa.Column('building_construction', mysql.VARCHAR(length=25), nullable=True)) op.add_column(u'surveys', sa.Column('gas_annual_post', mysql.FLOAT(), nullable=True)) op.add_column( u'surveys', sa.Column('follow_up_3_complete', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) op.add_column(u'surveys', sa.Column('elec_annual_pre', mysql.FLOAT(), nullable=True)) op.add_column(u'surveys', sa.Column('elec_annual_post', mysql.FLOAT(), nullable=True)) op.add_column(u'surveys', sa.Column('remedial_measures', mysql.TEXT(), nullable=True)) op.add_column( u'surveys', sa.Column('follow_up_1_complete', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) op.add_column(u'surveys', sa.Column('solid_annual_post', mysql.FLOAT(), nullable=True)) op.add_column( u'surveys', sa.Column('renewable_contribution_post', mysql.FLOAT(), nullable=True)) op.drop_table('results') op.drop_table('follow_ups')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('resource', 'price', existing_type=mysql.INTEGER(display_width=11), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('user', sa.Column('rooms', mysql.INTEGER(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'user', type_='foreignkey') op.create_foreign_key('user_ibfk_1', 'user', 'room', ['rooms'], ['id']) op.drop_column('user', 'u_rooms')
def load_dialect_impl(self, dialect): if dialect.name == "mysql": return dialect.type_descriptor(mysql.INTEGER(unsigned=True)) return self.impl
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('user', 'active', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('storage_list', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('storage_list', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('repair_return_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('repair_return_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('repair_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('repair_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.drop_column('put_storage_version', 'accessory') op.drop_column('put_storage', 'accessory') op.drop_column('put_out_store_version', 'telephone') op.drop_column('put_out_store_version', 'mailbox') op.drop_column('put_out_store_version', 'fax') op.drop_column('put_out_store_version', 'contactPerson') op.drop_column('put_out_store_version', 'companyAddr') op.drop_column('put_out_store_version', 'accessory') op.alter_column('put_out_store_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.INTEGER(display_width=11), existing_nullable=True) op.alter_column('put_out_store_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.INTEGER(display_width=11), existing_nullable=True) op.drop_column('put_out_store', 'telephone') op.drop_column('put_out_store', 'mailbox') op.drop_column('put_out_store', 'fax') op.drop_column('put_out_store', 'contactPerson') op.drop_column('put_out_store', 'companyAddr') op.drop_column('put_out_store', 'accessory') op.drop_column('loan_return_order_version', 'telephone') op.drop_column('loan_return_order_version', 'mailbox') op.drop_column('loan_return_order_version', 'fax') op.drop_column('loan_return_order', 'telephone') op.drop_column('loan_return_order', 'mailbox') op.drop_column('loan_return_order', 'fax') op.alter_column('loan_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('loan_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.drop_column('loan_application_version', 'telephone') op.drop_column('loan_application_version', 'mailbox') op.drop_column('loan_application_version', 'fax') op.drop_column('loan_application', 'telephone') op.drop_column('loan_application', 'mailbox') op.drop_column('loan_application', 'fax') op.alter_column('lend_application_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('lend_application_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('file_resource_version', 'addTime', existing_type=sa.TIMESTAMP(timezone=True), type_=mysql.TIMESTAMP(), existing_nullable=True, autoincrement=False) op.alter_column('file_resource', 'addTime', existing_type=sa.TIMESTAMP(timezone=True), server_default=sa.text( u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), type_=mysql.TIMESTAMP(), existing_nullable=False) op.alter_column('examine_repair_record_version', 'Soluted', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True, autoincrement=False) op.alter_column('examine_repair_record', 'Soluted', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('disassemble_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('disassemble_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.drop_column('borrowing_in_return_version', 'telephone') op.drop_column('borrowing_in_return_version', 'mailbox') op.drop_column('borrowing_in_return_version', 'fax') op.drop_column('borrowing_in_return_version', 'companyAddr') op.alter_column('borrowing_in_return_material', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('borrowing_in_return_material', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.drop_column('borrowing_in_return', 'telephone') op.drop_column('borrowing_in_return', 'mailbox') op.drop_column('borrowing_in_return', 'fax') op.drop_column('borrowing_in_return', 'companyAddr') op.alter_column('basic_action', 'view', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'upload_meeting_file', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'upload_contract_file', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'submit_review', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'submit', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'stored', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'sent', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'send', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'second_approved', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'second_approve_refuse', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'review_refuse', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'review_approve', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'review_again', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'review', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'reserve_again', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'receive', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'put_in_store', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'purchase_application', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'out_store_part', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'out_store_finish', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'in_store_part', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'in_store_finish', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'finish', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'edit_bound_status', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'edit', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'delete', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_st', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_scrap', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_rw', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_rp_rt', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_rf', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_out', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_mr', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_lr', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_in', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_er', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_eo', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_br', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create_as', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'create', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'check_complete', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'cancel', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'borrowing_in_return', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'borrow_application', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'approved', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'approve_refuse', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('basic_action', 'approve', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.drop_column('basic_action', 'remove_bound_status') op.drop_column('basic_action', 'export_pdf') op.alter_column('assemble_application_list', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('assemble_application_list', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('airmaterial_category_version', 'isOrNotHavePeriodCheck', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True, autoincrement=False) op.alter_column('airmaterial_category_version', 'isOrNotHaveEffectiveDate', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True, autoincrement=False) op.alter_column('airmaterial_category', 'isOrNotHavePeriodCheck', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('airmaterial_category', 'isOrNotHaveEffectiveDate', existing_type=sa.Boolean(), type_=mysql.TINYINT(display_width=1), existing_nullable=True) op.alter_column('air_material_storage_list_version', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True, autoincrement=False) op.alter_column('air_material_storage_list_version', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True, autoincrement=False) op.alter_column('air_material_storage_list', 'flyTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True) op.alter_column('air_material_storage_list', 'engineTime', existing_type=sa.String(length=255), type_=mysql.FLOAT(), existing_nullable=True)
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('replies', 'comment_id', existing_type=mysql.INTEGER(display_width=11), nullable=False) op.drop_constraint('replies_ibfk_1', 'replies', type_='foreignkey')
import ipaddress from datetime import datetime from flask_login import UserMixin from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.sql import func from werkzeug.security import generate_password_hash, check_password_hash from app import db, login from sqlalchemy.dialects import postgresql, mysql, sqlite from sqlalchemy import BigInteger, Integer UnsignedIntType = Integer() UnsignedIntType = UnsignedIntType.with_variant(mysql.INTEGER(unsigned=True), 'mysql') BigIntegerType = BigInteger() BigIntegerType = BigIntegerType.with_variant(postgresql.BIGINT(), 'postgresql') BigIntegerType = BigIntegerType.with_variant(mysql.BIGINT(), 'mysql') BigIntegerType = BigIntegerType.with_variant(sqlite.INTEGER(), 'sqlite') # TO-DO: server_default=text('now()') """ from pytz import timezone from datetime import datetime UTC = timezone('UTC') def time_now(): return datetime.now(UTC)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_foreign_key('replies_ibfk_1', 'replies', 'comments', ['comment_id'], ['id'], ondelete='SET NULL') op.alter_column('replies', 'comment_id', existing_type=mysql.INTEGER(display_width=11), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('submission', 'latestVersionId', existing_type=mysql.INTEGER(display_width=11), nullable=False)
def upgrade(): conn = op.get_bind() op.create_table( GROUP_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('name', sa.Unicode(50), unique=True), sa.Column('payload', sa.Text), sa.Column('auto_group_list', sa.Text) ) op.create_table( USER_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('telegram_id', my.BIGINT(unsigned=True), unique=True), sa.Column('telegram_handle', sa.Unicode(32)), sa.Column('name', sa.Unicode(20)), sa.Column('lastname', sa.Unicode(50)), sa.Column('vat_id', sa.Unicode(20), unique=True), sa.Column('invoice_address', sa.Unicode(250)), sa.Column('shipping_address', sa.Unicode(250)), sa.Column('email_address', sa.Unicode(50)), sa.Column('phone_number', sa.Unicode(20)) ) op.create_table( ROLE_TABLE_NAME, sa.Column('user_ref', my.INTEGER(unsigned=True), primary_key=True), sa.Column('group_ref', my.INTEGER(unsigned=True), primary_key=True), sa.Column('role', sa.Enum(RoleLevel), default=RoleLevel.user) ) op.create_foreign_key( GROUP_FK_NAME, ROLE_TABLE_NAME, GROUP_TABLE_NAME, ['group_ref'], ['id'], ) op.create_foreign_key( USER_FK_NAME, ROLE_TABLE_NAME, USER_TABLE_NAME, ['user_ref'], ['id'], ) op.create_table( CATALOG_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('name', sa.Unicode(255), nullable=False, default=''), sa.Column('group_ref', my.INTEGER(unsigned=True), nullable=False) ) op.create_foreign_key( CATALOG_GROUP_FK_NAME, CATALOG_TABLE_NAME, GROUP_TABLE_NAME, ['group_ref'], ['id'] ) op.create_table( ORDER_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('user_ref', my.INTEGER(unsigned=True), nullable=False), sa.Column('status', sa.Enum(OrderStatus), default=OrderStatus.received), sa.Column('shipping_price', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('shipping_tax', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('customer_notes', sa.Unicode(255), nullable=False, default=''), sa.Column('status_notes', sa.Unicode(255), nullable=False, default=''), sa.Column('invoice_to', sa.Unicode(255), nullable=False, default=''), sa.Column('ship_to', sa.Unicode(255), nullable=False, default='') ) op.create_foreign_key( ORDER_USER_FK_NAME, ORDER_TABLE_NAME, USER_TABLE_NAME, ['user_ref'], ['id'] ) op.create_table( PRODUCT_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('catalog_ref', my.INTEGER(unsigned=True), nullable=False), sa.Column('name', sa.Unicode(255), nullable=False, default=''), sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('tax', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('detail', sa.Unicode(255), nullable=False, default=''), ) op.create_foreign_key( PRODUCT_CATALOG_FK_NAME, PRODUCT_TABLE_NAME, CATALOG_TABLE_NAME, ['catalog_ref'], ['id'] ) op.create_table( LINEITEM_TABLE_NAME, sa.Column('order_ref', my.INTEGER(unsigned=True)), sa.Column('product_ref', my.INTEGER(unsigned=True)), sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('tax', sa.Numeric(precision=10, scale=2), nullable=False, default=0), sa.Column('quantity', my.INTEGER(unsigned=True), nullable=False, default=1) ) op.create_primary_key( LINEITEM_PK_NAME, LINEITEM_TABLE_NAME, ['order_ref', 'product_ref'] ) op.create_foreign_key( LINEITEM_ORDER_FK_NAME, LINEITEM_TABLE_NAME, ORDER_TABLE_NAME, ['order_ref'], ['id'] ) op.create_foreign_key( LINEITEM_PRODUCT_FK_NAME, LINEITEM_TABLE_NAME, PRODUCT_TABLE_NAME, ['product_ref'], ['id'] ) op.create_table( CARTITEM_TABLE_NAME, sa.Column('user_ref', my.INTEGER(unsigned=True)), sa.Column('product_ref', my.INTEGER(unsigned=True)), sa.Column('quantity', my.INTEGER(unsigned=True), nullable=False, default=1) ) op.create_primary_key( CARTITEM_PK_NAME, CARTITEM_TABLE_NAME, ['user_ref', 'product_ref'] ) op.create_foreign_key( CARTITEM_USER_FK_NAME, CARTITEM_TABLE_NAME, USER_TABLE_NAME, ['user_ref'], ['id'] ) op.create_foreign_key( CARTITEM_PRODUCT_FK_NAME, CARTITEM_TABLE_NAME, PRODUCT_TABLE_NAME, ['product_ref'], ['id'] ) op.create_table( DISCOUNT_TABLE_NAME, sa.Column('id', my.INTEGER(unsigned=True), primary_key=True), sa.Column('product_ref', my.INTEGER(unsigned=True), index=True), sa.Column('catalog_ref', my.INTEGER(unsigned=True), index=True), sa.Column('group_ref', my.INTEGER(unsigned=True), index=True), sa.Column('user_ref', my.INTEGER(unsigned=True), index=True), sa.Column('discount_price', sa.Numeric(precision=10, scale=2), default=0), sa.Column('discount_percent', sa.Numeric(precision=10, scale=2), default=0) ) # --- INSERT GROUPS conn.execute('INSERT INTO user_group (id, name, auto_group_list) VALUES (1, "Admin", NULL)') conn.execute('INSERT INTO user_group (id, name, auto_group_list) VALUES (2, "All Users", "all")') # Save first 100 groups for special bot groups. conn.execute('ALTER TABLE user_group AUTO_INCREMENT=100')
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'categorys') op.add_column( 'categorys', sa.Column('count', mysql.INTEGER(display_width=11), nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) op.create_index('student_id', 'users', ['student_id'], unique=True) op.drop_table('circuits')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('customers', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), sa.Column('lastname', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=100), nullable=True), sa.Column('name', mysql.VARCHAR(length=100), nullable=False), sa.Column('issuenum', mysql.INTEGER(), autoincrement=False, nullable=True), sa.Column('phone', mysql.VARCHAR(length=100), nullable=False), sa.Column('email', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=100), nullable=True), sa.Column('deliverydate', mysql.DATETIME(fsp=6), nullable=True), sa.Column('message', mysql.TEXT(), nullable=True), sa.Column('isEnabled', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=4), server_default=sa.text("'No'"), nullable=False), sa.Column('status', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=100), nullable=True), sa.Column('lastMessageId', mysql.INTEGER(), autoincrement=False, nullable=True), sa.Column('lastsenddate', mysql.DATETIME(fsp=6), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('issuenum', 'customers', ['issuenum'], unique=True) op.create_table('groups', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), sa.Column('name', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=30), server_default=sa.text("'Users'"), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('name', 'groups', ['name'], unique=True) op.create_table('changelog', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), sa.Column('datecreated', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True), sa.Column('createuserid', mysql.INTEGER(), autoincrement=False, nullable=True), sa.Column('subject', mysql.VARCHAR(length=120), nullable=True), sa.Column('post', mysql.TEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('employee', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), sa.Column('lastname', mysql.VARCHAR(length=50), nullable=True), sa.Column('name', mysql.VARCHAR(length=255), nullable=True), sa.Column('createdate', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True), sa.Column('login', mysql.VARCHAR(length=20), nullable=False), sa.Column('password', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=255), nullable=False), sa.Column('status', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=10), nullable=False), sa.Column('email', mysql.VARCHAR(charset='utf8', collation='utf8_general_ci', length=30), nullable=True), sa.Column('lastlogon', mysql.DATETIME(), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('login', 'employee', ['login'], unique=True) op.create_table('group_membership', sa.Column('user_id', mysql.INTEGER(), autoincrement=False, nullable=False), sa.Column('group_id', mysql.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], name='group_membership_ibfk_2'), sa.ForeignKeyConstraint(['user_id'], ['employee.id'], name='group_membership_ibfk_1'), sa.PrimaryKeyConstraint('user_id', 'group_id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.drop_table('tag')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('order_item', 'add_on_number', existing_type=mysql.INTEGER(display_width=10), nullable=False)
def downgrade(): op.add_column('arcade', sa.Column('paseli_infinite', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.add_column('arcade', sa.Column('paseli_enabled', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_column('arcade', 'data')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('photos', sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False), sa.Column('photographer_id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=False, nullable=False), sa.Column('photo_link', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('photo_type', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('category', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_collate='utf8_unicode_ci', mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('item', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column('name', mysql.VARCHAR(length=255), nullable=False), sa.Column('price', mysql.DECIMAL(precision=5, scale=2), server_default=sa.text("'0.00'"), nullable=True), sa.Column('created_at', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True), sa.Column('updated_at', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True), mysql_default_charset='latin1', mysql_engine='InnoDB') op.create_table('photographer', sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False), sa.Column('username', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('userpic', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('email', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('phone', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('city', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('information', mysql.VARCHAR(collation='utf8_unicode_ci', length=300), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_collate='utf8_unicode_ci', mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('price_list', sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False), sa.Column('photographer_id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=False, nullable=False), sa.Column('duration', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('place', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('category', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('price', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id'), mysql_collate='utf8_unicode_ci', mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('customer', sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False), sa.Column('username', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('userpic', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=True), sa.Column('email', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('phone', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_collate='utf8_unicode_ci', mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('order', sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False), sa.Column('customer_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False), sa.Column('photographer_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False), sa.Column('place', mysql.VARCHAR(collation='utf8_unicode_ci', length=50), nullable=False), sa.Column('date_begin', sa.DATE(), nullable=False), sa.Column('comment', mysql.VARCHAR(collation='utf8_unicode_ci', length=300), nullable=True), sa.Column('state', mysql.VARCHAR(collation='utf8_unicode_ci', length=20), server_default=sa.text("'In progress'"), nullable=True), sa.Column('date_end', sa.DATE(), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_collate='utf8_unicode_ci', mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('cycle', sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False), sa.Column('sth', mysql.CHAR(length=50), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='latin1', mysql_engine='InnoDB') op.drop_index(op.f('ix_user_username'), table_name='user') op.drop_index(op.f('ix_user_email'), table_name='user') op.drop_table('user')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('picturecontent', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('content', mysql.TEXT(), nullable=True), sa.Column('picture_id', mysql.VARCHAR(length=32), nullable=True), sa.ForeignKeyConstraint(['picture_id'], ['picture.id'], name='picturecontent_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('foodcontent', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('content', mysql.TEXT(), nullable=True), sa.Column('food_id', mysql.VARCHAR(length=32), nullable=True), sa.ForeignKeyConstraint(['food_id'], ['food.id'], name='foodcontent_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('users', sa.Column('id', mysql.VARCHAR(length=36), nullable=False), sa.Column('email', mysql.VARCHAR(length=50), nullable=True), sa.Column('name', mysql.VARCHAR(length=50), nullable=False), sa.Column('password', mysql.VARCHAR(length=200), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('email', 'users', ['email'], unique=True) op.create_table('food', sa.Column('id', mysql.VARCHAR(length=32), nullable=False), sa.Column('food_type', mysql.VARCHAR(length=20), nullable=True), sa.Column('food_title', mysql.VARCHAR(length=200), nullable=True), sa.Column('food_desc', mysql.VARCHAR(length=500), nullable=True), sa.Column('food_abstract', mysql.VARCHAR(length=200), nullable=True), sa.Column('food_date', sa.DATE(), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('id', 'food', ['id'], unique=True) op.create_table('picturepic', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('pic_url', mysql.VARCHAR(length=100), nullable=True), sa.Column('picture_id', mysql.VARCHAR(length=32), nullable=True), sa.ForeignKeyConstraint(['picture_id'], ['picture.id'], name='picturepic_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('foodpic', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), sa.Column('pic_url', mysql.VARCHAR(length=100), nullable=True), sa.Column('food_id', mysql.VARCHAR(length=32), nullable=True), sa.ForeignKeyConstraint(['food_id'], ['food.id'], name='foodpic_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_table('picture', sa.Column('id', mysql.VARCHAR(length=32), nullable=False), sa.Column('pic_type', mysql.VARCHAR(length=20), nullable=True), sa.Column('pic_title', mysql.VARCHAR(length=200), nullable=True), sa.Column('pic_abstract', mysql.VARCHAR(length=200), nullable=True), sa.Column('pic_desc', mysql.VARCHAR(length=500), nullable=True), sa.Column('pic_date', sa.DATE(), nullable=True), sa.PrimaryKeyConstraint('id'), mysql_default_charset='utf8', mysql_engine='InnoDB') op.create_index('id', 'picture', ['id'], unique=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('scheduler_item_v2', sa.Column('interval', mysql.INTEGER(), autoincrement=False, nullable=False, comment='item run interval in second')) op.drop_column('scheduler_item_v2', 'interval_time')