Beispiel #1
0
def migrate_volumes_into_extension_downgrade():
    # NOTE(eli): we don't support data downgrade, so we just change
    # schema to represent previous db schema state
    op.drop_table(extensions_migration_buffer_table_name)
    op.add_column(
        'node_attributes',
        sa.Column('volumes', fields.JSON(), nullable=True))
Beispiel #2
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('completed_tasks', 'completed_later',
               existing_type=sa.BOOLEAN(),
               nullable=False,
               existing_server_default=sa.text("'false'"))
    op.drop_table('site_administration')
Beispiel #3
0
def upgrade():
    op.drop_table('metrics')
    op.create_table('metrics_historical',
                    sa.Column('timestamp', sa.DateTime(), nullable=False),
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('challenge_slug', sa.String(), nullable=False),
                    sa.Column('status', sa.String(), nullable=False),
                    sa.Column('count', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('timestamp',
                                            'user_id',
                                            'challenge_slug',
                                            'status')
                    )
    op.create_index('idx_metrics_challengeslug',
                    'metrics_historical',
                    ['challenge_slug'],
                    unique=False)
    op.create_index('idx_metrics_status',
                    'metrics_historical',
                    ['status'],
                    unique=False)
    op.create_index('idx_metrics_userid',
                    'metrics_historical',
                    ['user_id'],
                    unique=False)
    op.create_table('metrics_aggregate',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('challenge_slug', sa.String(), nullable=False),
                    sa.Column('status', sa.String(), nullable=False),
                    sa.Column('count', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('user_id',
                                            'challenge_slug',
                                            'status')
                    )
def downgrade():
    ### commands auto generated by Alembic ###

    op.drop_table('patientMedicalRecords')

    op.create_table('patientMedicalRecords',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('patient_id', sa.Integer(), nullable=False),
    sa.Column('implants', sa.Boolean(), nullable=True),
    sa.Column('previousTreatments', sa.String(length=150), nullable=True),
    sa.Column('height', sa.Integer(), nullable=True),
    sa.Column('weight', sa.Integer(), nullable=True),
    sa.Column('highestWeight', sa.Integer(), nullable=True),
    sa.Column('seriousInjuries', sa.Boolean(), nullable=True),
    sa.Column('allergics', sa.Boolean(), nullable=True),
    sa.Column('nutritionalOrHerbalSupplements', sa.Boolean(), nullable=True),
    sa.Column('skinDisease', sa.Boolean(), nullable=True),
    sa.Column('bloodDisease', sa.Boolean(), nullable=True),
    sa.Column('kidneyDisease', sa.Boolean(), nullable=True),
    sa.Column('cancer', sa.Boolean(), nullable=True),
    sa.Column('diabetes', sa.Boolean(), nullable=True),
    sa.Column('heartDisease', sa.Boolean(), nullable=True),
    sa.Column('highBloodPressure', sa.Boolean(), nullable=True),
    sa.Column('liverDisease', sa.Boolean(), nullable=True),
    sa.Column('highCholesterol', sa.Boolean(), nullable=True),
    sa.Column('lungDisease', sa.Boolean(), nullable=True),
    sa.Column('epilepsy', sa.Boolean(), nullable=True),
    sa.Column('hepatitis', sa.Boolean(), nullable=True),
    sa.Column('thyroidProblem', sa.Boolean(), nullable=True),
    sa.Column('createdBy_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['createdBy_id'], ['users.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['patient_id'], ['patients.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
def downgrade():
    connection = op.get_bind()

    # Create old AZ fields
    op.add_column('services', Column('availability_zone', String(length=255)))
    op.add_column('share_instances',
                  Column('availability_zone', String(length=255)))

    # Migrate data
    az_table = utils.load_table('availability_zones', connection)
    share_instances_table = utils.load_table('share_instances', connection)
    services_table = utils.load_table('services', connection)

    for az in connection.execute(az_table.select()):
        op.execute(
            share_instances_table.update().where(
                share_instances_table.c.availability_zone_id == az.id
            ).values({'availability_zone': az.name})
        )
        op.execute(
            services_table.update().where(
                services_table.c.availability_zone_id == az.id
            ).values({'availability_zone': az.name})
        )

    # Remove AZ_id columns and AZ table
    op.drop_constraint('service_az_id_fk', 'services', type_='foreignkey')
    op.drop_column('services', 'availability_zone_id')
    op.drop_constraint('si_az_id_fk', 'share_instances', type_='foreignkey')
    op.drop_column('share_instances', 'availability_zone_id')
    op.drop_table('availability_zones')
def downgrade():
    for query in ("alter table company DROP FOREIGN KEY company_ibfk_1",
                  "alter table company DROP FOREIGN KEY company_ibfk_2",):
        op.execute(query)
    op.drop_column('company', 'logo_id')
    op.drop_column('company', 'header_id')
    op.drop_table('config_files')
Beispiel #7
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'whoyoulookinat')
    op.create_unique_constraint(u'whoyoulookinat_user_id_looking_at_twitter_display_name_key', 'whoyoulookinat', [u'looking_at_twitter_display_name', u'user_id'])
    op.drop_constraint(None, 'twitter_friends_cache')
    op.create_unique_constraint(u'twitter_friends_cache_twitter_id_friend_twitter_id_key', 'twitter_friends_cache', [u'friend_twitter_id', u'twitter_id'])
    op.drop_table('received_transitory_glance')
def finalize_config():
    bind = op.get_bind()
    session = Session(bind=bind)

    Config.__table__.create(bind)
    print("--------------------------------")
    print("Migrate remaining config entries")

    configs = session.query(Config_old)
    for conf in configs:
        key = ".".join(conf.Key.split(".")[1:])
        value = conf.Value
        Type = conf.Type
        Description = conf.Description
        if key == "FailCounterIncOnFalsePin":
            key = "IncFailCountOnFalsePin"
            value = (conf.Value == "True")
        if Type == "bool":
            value = (conf.Value == "True")
        if key == "splitAtSign":
            value = (conf.Value == "True")
            Type = "bool"

        c = Config(Key=key,
                   Value=value,
                   Type=Type,
                   Description=Description)
        session.add(c)
    session.commit()
    op.drop_table('Config_old')
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'tracks', 'location')
    op.drop_constraint(None, 'sponsors', type_='foreignkey')
    op.drop_column(u'sponsors', 'sponsor_type_id')
    op.drop_column(u'sponsors', 'description')
    op.drop_table('sponsor_type')
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(u'notes_section_id_fkey', 'notes', type_='foreignkey')
    op.drop_column('notes', 'section_id')
    op.drop_table('sections')
    op.add_column('notes', sa.Column('notebook_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'notes', 'notebooks', ['notebook_id'], ['id'])
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table(u'adu_by_build')
    ### end Alembic commands ###
    load_stored_proc(op, ['backfill_crash_adu_by_build_signature.sql',
                          'backfill_matviews.sql',
                          'update_crash_adu_by_build_signature.sql'])
Beispiel #12
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    drop_table('skills')
    drop_column(u'items', 'hon_name')
    drop_column(u'items', 'order')
    alter_column(u'items', 'vendor', name='category')
    drop_column(u'heroes', 'day_site_range')
    drop_column(u'heroes', 'min_damage')
    drop_column(u'heroes', 'intelligence')
    drop_column(u'heroes', 'agility')
    drop_column(u'heroes', 'night_site_range')
    drop_column(u'heroes', 'min_attack_animation')
    drop_column(u'heroes', 'attack_range')
    drop_column(u'heroes', 'strength_gain')
    drop_column(u'heroes', 'strength')
    drop_column(u'heroes', 'min_hp')
    drop_column(u'heroes', 'armor')
    drop_column(u'heroes', 'intelligence_gain')
    drop_column(u'heroes', 'movespeed')
    drop_column(u'heroes', 'max_hp')
    drop_column(u'heroes', 'max_cast_animation')
    drop_column(u'heroes', 'stat')
    drop_column(u'heroes', 'faction')
    drop_column(u'heroes', 'missile_speed')
    drop_column(u'heroes', 'max_damage')
    drop_column(u'heroes', 'min_cast_animation')
    drop_column(u'heroes', 'max_mana')
    drop_column(u'heroes', 'roles')
    drop_column(u'heroes', 'base_attack_time')
    drop_column(u'heroes', 'agility_gain')
    drop_column(u'heroes', 'min_mana')
    drop_column(u'heroes', 'max_attack_animation')
    drop_column(u'heroes', 'order')
Beispiel #13
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('privilege')
    op.add_column('engagement_order', sa.Column('uuid', sa.String(length=2), nullable=False))
    op.drop_column('engagement_order', 'id')
    op.create_unique_constraint(None, 'job_label', ['name'])
    op.create_unique_constraint(None, 'personal_label', ['name'])
Beispiel #14
0
def drop_column_sqlite(tablename, columns):
    """ column dropping functionality for SQLite """

    # we need copy to make a deep copy of the column attributes
    from copy import copy

    # get the db engine and reflect database tables
    engine = op.get_bind()
    meta = sa.MetaData(bind=engine)
    meta.reflect()

    # create a select statement from the old table
    old_table = meta.tables[tablename]
    select = sa.sql.select([c for c in old_table.c if c.name not in columns])

    # get remaining columns without table attribute attached
    remaining_columns = [copy(c) for c in old_table.columns if c.name not in columns]
    for column in remaining_columns:
        column.table = None

    # create a temporary new table
    new_tablename = "{0}_new".format(tablename)
    op.create_table(new_tablename, *remaining_columns)
    meta.reflect()
    new_table = meta.tables[new_tablename]

    # copy data from old table
    insert = sa.sql.insert(new_table).from_select([c.name for c in remaining_columns], select)
    engine.execute(insert)

    # drop the old table and rename the new table to take the old tables
    # position
    op.drop_table(tablename)
    op.rename_table(new_tablename, tablename)
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return
    op.create_table(
        'servicetypes',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('tenant_id', sa.String(length=255)),
        sa.Column('name', sa.String(255)),
        sa.Column('description', sa.String(255)),
        sa.Column('default', sa.Boolean(), nullable=False, default=False),
        sa.Column('num_instances', sa.Integer, default=0),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'servicedefinitions',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('service_class', sa.String(255)),
        sa.Column('plugin', sa.String(255)),
        sa.Column('driver', sa.String(255)),
        sa.Column('service_type_id', sa.String(36),
                  sa.ForeignKey('servicetypes.id',
                                ondelete='CASCADE')),
        sa.PrimaryKeyConstraint('id', 'service_class')
    )
    op.drop_table('providerresourceassociations')
Beispiel #16
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('modules', sa.Column('id', sa.INTEGER(), nullable=False))
    op.alter_column('modules', 'description',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('modules', 'active',
               existing_type=sa.BOOLEAN(),
               nullable=True)
    op.alter_column('modules', 'abbreviation',
               existing_type=sa.VARCHAR(length=20),
               nullable=True)
    op.create_table('group_roles',
    sa.Column('permission', sa.VARCHAR(length=80), autoincrement=False, nullable=False),
    sa.Column('read', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('write', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('update', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('delete', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('role', sa.VARCHAR(length=20), autoincrement=False, nullable=False)
    )
    op.create_table('admin_roles',
    sa.Column('role', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('permission', sa.VARCHAR(length=80), autoincrement=False, nullable=False),
    sa.Column('read', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('write', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('update', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('delete', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('role', name='admin_roles_pkey')
    )
    op.drop_table('roles')
    op.drop_table('permissions')
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(u'ix_TranslationSubscriptions_mechanism', table_name='TranslationSubscriptions')
    op.drop_table('TranslationSubscriptions')
    op.drop_index(u'ix_TranslationNotificationRecipients_email', table_name='TranslationNotificationRecipients')
    op.drop_index(u'ix_TranslationNotificationRecipients_created', table_name='TranslationNotificationRecipients')
    op.drop_table('TranslationNotificationRecipients')
Beispiel #18
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_notification_user_id'), table_name='notification')
    op.drop_index(op.f('ix_notification_read'), table_name='notification')
    op.drop_index(op.f('ix_notification_message'), table_name='notification')
    op.drop_index(op.f('ix_notification_create_at'), table_name='notification')
    op.drop_table('notification')
Beispiel #19
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('permissions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('role', sa.String(length=20), nullable=True),
    sa.Column('module', sa.String(length=3), nullable=True),
    sa.Column('permission', sa.String(length=80), nullable=False),
    sa.Column('read', sa.Boolean(), nullable=False),
    sa.Column('write', sa.Boolean(), nullable=False),
    sa.Column('update', sa.Boolean(), nullable=False),
    sa.Column('delete', sa.Boolean(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('roles',
    sa.Column('role', sa.String(length=20), nullable=False),
    sa.Column('module_abbreviation', sa.String(length=3), nullable=False),
    sa.PrimaryKeyConstraint('role', 'module_abbreviation')
    )
    op.drop_table('admin_roles')
    op.drop_table('group_roles')
    op.alter_column('modules', 'abbreviation',
               existing_type=sa.VARCHAR(length=20),
               nullable=False)
    op.alter_column('modules', 'active',
               existing_type=sa.BOOLEAN(),
               nullable=False)
    op.alter_column('modules', 'description',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.drop_column('modules', 'id')
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'payout', 'perc_applied')
    op.drop_column(u'payout', 'perc')
    op.drop_column(u'payout', 'locked')
    op.drop_table('bonus_payout')
    op.drop_table('donation_percent')
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'service',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=False),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column('category_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['category_id'], ['categories.id'], ),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('name')
    )
    op.drop_table('alert_categories')
    op.drop_table('user_categories')
    op.create_table(
        'alert_services',
        sa.Column('alert_id', sa.Integer(), nullable=False),
        sa.Column('service_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['alert_id'], ['alerts.id'], ),
        sa.ForeignKeyConstraint(['service_id'], ['service.id'], ),
    )
    op.create_table(
        'user_services',
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('service_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
        sa.ForeignKeyConstraint(['service_id'], ['service.id'], ),
    )
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('routerl3agentbindings')
    op.drop_table('networkdhcpagentbindings')
Beispiel #23
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_answer_votes_user_id'), table_name='answer_votes')
    op.drop_index(op.f('ix_answer_votes_created_at'), table_name='answer_votes')
    op.drop_index(op.f('ix_answer_votes_answer_id'), table_name='answer_votes')
    op.drop_table('answer_votes')
    op.drop_index(op.f('ix_trackers_tracker_id'), table_name='trackers')
    op.drop_index(op.f('ix_trackers_questions_id'), table_name='trackers')
    op.drop_index(op.f('ix_trackers_created_at'), table_name='trackers')
    op.drop_table('trackers')
    op.drop_index('m2m_tag_questions_id', table_name='tag_x_questions')
    op.drop_index('m2m_tag_questions_cid', table_name='tag_x_questions')
    op.drop_index('m2m_tag_no_duplicates_questions', table_name='tag_x_questions')
    op.drop_table('tag_x_questions')
    op.drop_index(op.f('ix_answers_user_id'), table_name='answers')
    op.drop_index(op.f('ix_answers_text'), table_name='answers')
    op.drop_index(op.f('ix_answers_questions_id'), table_name='answers')
    op.drop_index(op.f('ix_answers_created_at'), table_name='answers')
    op.drop_table('answers')
    op.drop_index(op.f('ix_questions_user_id'), table_name='questions')
    op.drop_index(op.f('ix_questions_text'), table_name='questions')
    op.drop_index(op.f('ix_questions_sharedtype'), table_name='questions')
    op.drop_index(op.f('ix_questions_isanonymous'), table_name='questions')
    op.drop_index(op.f('ix_questions_created_at'), table_name='questions')
    op.drop_index(op.f('ix_questions_sharedwith'), table_name='questions')
    op.drop_table('questions')
Beispiel #24
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('monster_actions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('category', sa.String(length=64), nullable=True),
    sa.Column('aura_range', sa.String(length=64), nullable=True),
    sa.Column('recharge', sa.String(length=64), nullable=True),
    sa.Column('frequency', sa.String(length=64), nullable=True),
    sa.Column('icon', sa.String(length=64), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=512), nullable=True),
    sa.Column('trigger', sa.String(length=512), nullable=True),
    sa.Column('trigger_usage', sa.String(length=512), nullable=True),
    sa.Column('attack', sa.String(length=64), nullable=True),
    sa.Column('hit', sa.String(length=512), nullable=True),
    sa.Column('miss', sa.String(length=512), nullable=True),
    sa.Column('effect', sa.String(length=512), nullable=True),
    sa.Column('secondary_attack', sa.String(length=512), nullable=True),
    sa.Column('aftereffect', sa.String(length=512), nullable=True),
    sa.Column('special', sa.String(length=512), nullable=True),
    sa.Column('keywords', sa.String(length=64), nullable=True),
    sa.Column('monster_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['monster_id'], ['monsters.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('Xmonster_actions')
Beispiel #25
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Xmonster_actions',
    sa.Column('id', sa.INTEGER(), server_default='nextval(\'"Xmonster_actions_id_seq"\'::regclass)', nullable=False),
    sa.Column('category', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('aura_range', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('recharge', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('frequency', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('icon', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('description', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('trigger', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('trigger_usage', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('attack', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('hit', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('miss', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('effect', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('secondary_attack', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('aftereffect', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('special', sa.VARCHAR(length=512), autoincrement=False, nullable=True),
    sa.Column('keywords', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('monster_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['monster_id'], [u'monsters.id'], name=u'Xmonster_actions_monster_id_fkey'),
    sa.PrimaryKeyConstraint('id', name=u'Xmonster_actions_pkey')
    )
    op.drop_table('monster_actions')
def downgrade(pyramid_env):
    if using_virtuoso():
        with context.begin_transaction():
            op.create_table('social_auth_account_temp',
                sa.Column('id', sa.Integer, primary_key=True),
                sa.Column('username', sa.String(200)))
            # Do stuff with the app's models here.
        from assembl import models as m
        db = m.get_session_maker()()
        with transaction.manager:
            db.execute("""INSERT INTO social_auth_account_temp
                       SELECT id, username FROM social_auth_account
                       WHERE username IS NOT NULL""")
            mark_changed()
        with context.begin_transaction():
            op.drop_column('social_auth_account', 'username')
            op.add_column(
                'social_auth_account', sa.Column('username', sa.String(200)))
        with transaction.manager:
            db.execute("""UPDATE social_auth_account
                       SET username = (
                       SELECT username FROM social_auth_account_temp
                       WHERE social_auth_account_temp.id = social_auth_account.id)""")
            mark_changed()
        with context.begin_transaction():
            op.drop_table('social_auth_account_temp')
    else:
        with context.begin_transaction():
            op.alter_column('social_auth_account', 'username', type_=sa.Unicode(200))
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user_expert_topic')
    op.add_column('user', sa.Column('has_selected_expert_topics', sa.Boolean(), nullable=True))
    op.drop_column('user', 'has_edited_expert_topics')
    op.add_column('user_topic_statistics', sa.Column('selected', sa.Boolean(), nullable=True))
    op.add_column('user_topic_statistics', sa.Column('show_order', sa.Integer(), nullable=True))
Beispiel #28
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('tweet_by_tweet_id', table_name='tweet')
    op.create_index('tweet_by_tweet_id', 'tweet', ['tweet_id'], unique=False)
    op.drop_index('tweetentity_by_tweet_id', table_name='tweet_entity')
    op.drop_table('tweet_entity')
    op.drop_table('tuser_tuser')
def downgrade():
    if not exists_in_db(op.get_bind(), 'mailinglist', 'header_matches'):
        # SQLite will not have deleted the former column, since it does not
        # support column deletion.
        op.add_column(
            'mailinglist',
            sa.Column('header_matches', sa.PickleType, nullable=True))
    # Now migrate the data.  It can't be offline because we need to read the
    # pickles.
    connection = op.get_bind()
    # Don't import the table definition from the models, it may break this
    # migration when the model is updated in the future (see the Alembic doc).
    mlist_table = sa.sql.table(
        'mailinglist',
        sa.sql.column('id', sa.Integer),
        sa.sql.column('header_matches', sa.PickleType)
        )
    header_match_table = sa.sql.table(
        'headermatch',
        sa.sql.column('mailing_list_id', sa.Integer),
        sa.sql.column('header', sa.Unicode),
        sa.sql.column('pattern', sa.Unicode),
        )
    for mlist_id, header, pattern in connection.execute(
            header_match_table.select()).fetchall():
        mlist = connection.execute(mlist_table.select().where(
            mlist_table.c.id == mlist_id)).fetchone()
        header_matches = mlist['header_matches']
        if not header_matches:
            header_matches = []
        header_matches.append((header, pattern))
        connection.execute(mlist_table.update().where(
            mlist_table.c.id == mlist_id).values(
            header_matches=header_matches))
    op.drop_table('headermatch')
def upgrade():
    op.drop_table('role')
    op.rename_table('tmp_role', 'role')
    op.rename_table('role_focus', 'tmp_role_focus')

    role_focus = op.create_table('role_focus',
        sa.Column('role_focus_id', sa.Integer(), nullable=False),
        sa.Column('role_id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('focus_name', sa.String(), nullable=True),
        sa.ForeignKeyConstraint(['role_id'], ['role.role_id'], name='fk_focus_role'),
        sa.PrimaryKeyConstraint('role_focus_id')
    )

    for focus in connection.execute(focus_helper.select()):
        op.bulk_insert(
            role_focus,
            [
                {
                    'role_focus_id': focus.role_id,
                    'role_id' : focus.role_id,
                    'user_id' : focus.user_id,
                    'focus_name' : focus.focus_name,
                },
            ]
        )

    op.drop_table('tmp_role_focus')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_name'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    op.drop_table('member__expense__share')
    op.drop_table('member')
    op.drop_index(op.f('ix_group__expense_expense_name'),
                  table_name='group__expense')
    op.drop_table('group__expense')
    op.drop_index(op.f('ix_group_name'), table_name='group')
    op.drop_table('group')
    op.drop_table('debt')
Beispiel #32
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('user', 'last_message_read_time')
    op.drop_index(op.f('ix_message_timestamp'), table_name='message')
    op.drop_table('message')
Beispiel #33
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('blacklist_tokens')
Beispiel #34
0
def downgrade():
    op.drop_table('reportarchive')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Instances',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('ip', mysql.VARCHAR(length=100), nullable=False),
                    sa.Column('url', mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('dbUser',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('dbName',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('dbPass',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('sshUser',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('sshPass',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'latin1',
                    mysql_engine=u'InnoDB')
    op.create_table('Roles',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('role', mysql.VARCHAR(length=100),
                              nullable=True),
                    sa.Column('capabilities',
                              mysql.VARCHAR(length=200),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'latin1',
                    mysql_engine=u'InnoDB')
    op.create_table('User',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('role', mysql.VARCHAR(length=100),
                              nullable=True),
                    sa.Column('email',
                              mysql.VARCHAR(length=100),
                              nullable=False),
                    sa.Column('name', mysql.VARCHAR(length=100),
                              nullable=True),
                    sa.Column('avatar',
                              mysql.VARCHAR(length=200),
                              nullable=True),
                    sa.Column('active',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('tokens',
                              mysql.VARCHAR(length=200),
                              nullable=True),
                    sa.Column('created_at', mysql.DATETIME(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'latin1',
                    mysql_engine=u'InnoDB')
    op.create_index('email', 'User', ['email'], unique=True)
    op.drop_table('user')
    op.drop_table('roles')
    op.drop_table('instances')
Beispiel #36
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("camera_configuration")
    op.drop_table("camera_sub_stream")
    op.drop_table("configurations")
    op.drop_table("cameras")
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('token')
    op.drop_table('user')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('checker_article')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('answer')
    op.drop_table('question')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('session')
Beispiel #41
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('interface')
    op.drop_table('lease')
Beispiel #42
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('doctors_plans')
    op.drop_table('doctors')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('storage')
    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')
Beispiel #44
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('users', 'streak')
    op.drop_table('followers')
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('pledge')
    op.drop_table('project')
    op.drop_table('member')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('actors_movies')
    op.drop_table('movies')
    op.drop_table('actors')
Beispiel #47
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_post_timestamp'), table_name='post')
    op.drop_table('post')
Beispiel #48
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_device_id'), table_name='user')
    op.drop_table('user')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('used_tokens')
Beispiel #50
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('query_polygon_parameters')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('items')
    op.drop_table('role_user_association')
    op.drop_table('products')
    op.drop_table('roles')
    op.drop_table('inventories')
    op.drop_table('users')
    op.drop_table('stores')
    op.drop_table('brands')
    op.drop_table('blacklist_tokens')
Beispiel #52
0
def downgrade():
    op.drop_table('chatd_line')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('payment_version', 'vat_invoice_number')
    op.drop_column('payment', 'vat_invoice_number')
    op.drop_table('payment_sequence')
Beispiel #54
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_fillup_timestamp"), table_name="fillup")
    op.drop_table("fillup")
    op.drop_table("vehicle")
    op.drop_table("user")
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_unique_constraint(u'queries_qid_key', 'queries', ['qid'])
    op.drop_table('library')
    op.drop_table('institute')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_comment_user_id'), table_name='comment')
    op.drop_index(op.f('ix_comment_news_id'), table_name='comment')
    op.drop_table('comment')
def downgrade():
    op.drop_table('link')
    op.drop_table('alias')
    op.drop_table('reference')
    op.drop_table('spider_tag')
    op.drop_table('card')
    op.drop_table('user')
Beispiel #58
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('users')
    op.drop_table('requestion')
    op.drop_table('country')
    op.drop_table('cart')
    op.drop_table('borrow_book')
    op.drop_table('books')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_message_timestamp', table_name='message')
    op.drop_table('message')
    op.drop_column('MEMORYBLOG_MASTER_USER', 'last_message_read_time')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('penentuan_kelas')