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 upgrade(): ''' Add the artifact field to the Package table, fill it and adjust the unique key constraints. ''' op.add_column( 'Package', sa.Column( 'namespace', sa.String(50), sa.ForeignKey( 'namespaces.namespace', onupdate='CASCADE', ondelete='CASCADE', ), default='rpms', ) ) op.execute('''UPDATE "Package" SET namespace='rpms';''') op.alter_column( 'Package', column_name='namespace', nullable=False, existing_nullable=True) op.execute(""" DROP INDEX IF EXISTS "ix_Package_name"; ALTER TABLE "Package" ADD CONSTRAINT "ix_package_name_namespace" UNIQUE (name, namespace); """)
def downgrade(active_plugins=None, options=None): enums = _define_enums() op.drop_column('tasks', 'status') op.add_column('tasks', sa.Column('status', enums['task_status_old'], nullable=True))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('order_groups', sa.Column('id', sa.Integer(), nullable=False), sa.Column('group_type', sa.Integer(), nullable=True), sa.Column('area_id', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('no', sa.Integer(), nullable=True), sa.Column('target', sa.String(length=64), nullable=True), sa.Column('now_level', sa.Integer(), nullable=True), sa.Column('status_id', sa.Integer(), nullable=True), sa.Column('create_man', sa.Integer(), nullable=True), sa.Column('create_date', sa.DateTime(), nullable=True), sa.Column('update_man', sa.Integer(), nullable=True), sa.Column('update_date', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['area_id'], ['areas.id'], ), sa.ForeignKeyConstraint(['create_man'], ['users.id'], ), sa.ForeignKeyConstraint(['status_id'], ['order_status.id'], ), sa.ForeignKeyConstraint(['update_man'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_order_groups_create_date'), 'order_groups', ['create_date'], unique=False) op.create_table('order_group_process', sa.Column('id', sa.Integer(), nullable=False), sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('oper', sa.Integer(), nullable=True), sa.Column('oper_time', sa.DateTime(), nullable=True), sa.Column('remark', sa.String(length=128), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['order_groups.id'], ), sa.ForeignKeyConstraint(['oper'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.add_column(u'orders', sa.Column('group_id', sa.Integer(), nullable=True))
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 upgrade(): conn = op.get_bind() op.add_column('external_identities', sa.Column('local_user_id', sa.Integer())) external_identities_t = table('external_identities', sa.Column('local_user_name', sa.Unicode(50)), sa.Column('local_user_id', sa.Integer)) users_t = table('users', sa.Column('user_name', sa.Unicode(50)), sa.Column('id', sa.Integer)) stmt = external_identities_t.update().values(local_user_id=users_t.c.id). \ where(users_t.c.user_name == external_identities_t.c.local_user_name) conn.execute(stmt) op.drop_constraint('pk_external_identities', 'external_identities', type='primary') op.drop_constraint('fk_external_identities_local_user_name_users', 'external_identities', type='foreignkey') op.drop_column('external_identities', 'local_user_name') op.create_primary_key('pk_external_identities', 'external_identities', cols=['external_id', 'local_user_id', 'provider_name']) op.create_foreign_key(None, 'external_identities', 'users', remote_cols=['id'], local_cols=['local_user_id'], onupdate='CASCADE', ondelete='CASCADE')
def upgrade(): if skip_based_on_legacy_engine_version(op, __name__): return for column in _columns: op.add_column('package', sa.Column(column, sa.UnicodeText)) op.add_column('package_revision', sa.Column(column, sa.UnicodeText))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### # print("Getting bind...") conn = op.get_bind() # print("Adding flags column back to challenges table") op.add_column('challenges', sa.Column('flags', sa.TEXT(), nullable=True)) # print("Dropping type column from challenges table") op.drop_column('challenges', 'type') # print("Executing: SELECT id, flags from challenges") res = conn.execute("SELECT id, flags from challenges") results = res.fetchall() # print("There are {} results".format(len(results))) for chal_id in results: new_keys = Keys.query.filter_by(chal=chal_id[0]).all() old_flags = [] for new_key in new_keys: flag_dict = {'flag': new_key.flag, 'type': new_key.key_type} old_flags.append(flag_dict) old_flags =json.dumps(old_flags) # print("Updating challenge {} to insert {}".format(chal_id[0], flag_dict)) conn.execute(text('UPDATE challenges SET flags=:flags WHERE id=:id'), id=chal_id[0], flags=old_flags)
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('machine_statistic', sa.Column('version', sa.String(length=64), nullable=True)) op.alter_column('statistic_visitor', 'referred', existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128), nullable=True, existing_server_default=sa.text(u"''"))
def upgrade(): op.add_column('role', sa.Column('password_digest', sa.Unicode)) op.add_column('role', sa.Column('reset_token', sa.Unicode)) op.create_index( op.f('role_reset_token'), 'role', ['reset_token'], unique=True )
def downgrade(pyramid_env): with context.begin_transaction(): op.add_column('idea_message_column', sa.Column('header_id', sa.Integer(), sa.ForeignKey('langstring.id'))) from assembl import models as m db = m.get_session_maker()() with transaction.manager: columns = db.query(m.IdeaMessageColumn).all() for column in columns: synthesis = column.get_column_synthesis() if synthesis is not None: header = synthesis.body.clone() # we need to clone here, otherwise the langstring is deleted with db.delete(synthesis) # because of the delete-orphan on the relationship and result to an Integrity error # because the langstring is still referenced from idea_message_column table. db.add(header) db.flush() # we can't use here: column.header_id = header.id # the mapper doesn't now about header_id and the change # will not be committed db.execute("""update idea_message_column set header_id = %d where id = %d""" % (header.id, column.id)) mark_changed() db.delete(synthesis)
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('product', sa.Column('create_date', sa.DateTime(), nullable=True)) results = op.get_bind().execute(text(""" select prd.id, min(po.order_date) from purchase_order po, product prd, purchase_order_line pol where pol.product_id = prd.id and po.id = pol.purchase_order_id group by prd.id """)).fetchall() for r in results: sup_id = r[0] po_date = r[1] sql = "update product set create_date = '{0}' where id={1}".format(po_date, sup_id) op.get_bind().execute(text(sql)) results = op.get_bind().execute(text(""" select p.id, min(so.order_date) from sales_order so, sales_order_line sol, product p where so.id = sol.sales_order_id and sol.product_id = p.id group by p.id; """)).fetchall() for r in results: sup_id = r[0] so_date = r[1] sql = "update product set create_date = '{0}' where id={1} and create_date is null".format(so_date, sup_id) op.get_bind().execute(text(sql)) op.get_bind().execute(text("update product set create_date = '{0}' where create_date is null".format(datetime.now()))) op.alter_column('product', 'create_date', existing_type=sa.DateTime(), nullable=False)
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column(u'messages_drawing_move', sa.Column('special_message_finish_drawing_id', sa.String(length=2000), nullable=True)) op.add_column(u'messages_drawing_move', sa.Column('special_message_start_drawing_id', sa.String(length=2000), nullable=True)) op.drop_column(u'messages_drawing_move', 'special_message_id') op.create_index(op.f('ix_messages_drawing_move_special_message_finish_drawing_id'), 'messages_drawing_move', ['special_message_finish_drawing_id'], unique=False) op.create_index(op.f('ix_messages_drawing_move_special_message_start_drawing_id'), 'messages_drawing_move', ['special_message_start_drawing_id'], unique=False)
def downgrade(): op.add_column('thread', sa.Column('receivedrecentdate', sa.DATETIME(), server_default=sa.sql.null(), nullable=True)) op.create_index('ix_thread_namespace_id_receivedrecentdate', 'thread', ['namespace_id', 'receivedrecentdate'], unique=False)
def upgrade(): op.create_table(u'exploitability_reports', sa.Column(u'signature_id', sa.INTEGER(), nullable=False), sa.Column(u'report_date', sa.DATE(), nullable=False), sa.Column(u'null_count', sa.INTEGER(), server_default='0', nullable=False), sa.Column(u'none_count', sa.INTEGER(), server_default='0', nullable=False), sa.Column(u'low_count', sa.INTEGER(), server_default='0', nullable=False), sa.Column(u'medium_count', sa.INTEGER(), server_default='0', nullable=False), sa.Column(u'high_count', sa.INTEGER(), server_default='0', nullable=False), sa.ForeignKeyConstraint(['signature_id'], [u'signatures.signature_id'], ), sa.PrimaryKeyConstraint() ) # We can probably get away with just applying this to the parent table # If there are performance problems on stage, break this out and apply to all # child partitions first, then reports_clean last. op.add_column(u'reports_clean', sa.Column(u'exploitability', sa.TEXT(), nullable=True)) app_path=os.getcwd() procs = [ '001_update_reports_clean.sql' , 'update_exploitability.sql' , 'backfill_exploitability.sql' ] for myfile in [app_path + '/socorro/external/postgresql/raw_sql/procs/' + line for line in procs]: proc = open(myfile, 'r').read() op.execute(proc)
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'])
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 upgrade(): op.add_column('nodes', sa.Column('inspection_started_at', sa.DateTime(), nullable=True)) op.add_column('nodes', sa.Column('inspection_finished_at', sa.DateTime(), nullable=True))
def upgrade_table(table_name): """Add audit foreign key to a table.""" op.add_column( table_name, sa.Column("audit_id", sa.Integer(), nullable=True) ) op.execute(""" UPDATE {table_name} AS t JOIN contexts AS c ON c.id = t.context_id AND c.related_object_type = "Audit" JOIN audits AS au ON c.related_object_id = au.id SET t.audit_id = au.id """.format( table_name=table_name, )) op.alter_column( table_name, "audit_id", existing_type=sa.Integer(), nullable=False ) op.create_foreign_key( "fk_{}_audits".format(table_name), table_name, "audits", ["audit_id"], ["id"], ondelete="RESTRICT" )
def upgrade(): op.alter_column( 'cycle_task_group_object_tasks', 'cycle_task_group_object_id', existing_type=sa.Integer(), nullable=True ) op.add_column( 'cycle_task_group_object_tasks', sa.Column('cycle_task_group_id', sa.Integer(), nullable=False) ) op.execute(""" UPDATE cycle_task_group_object_tasks SET cycle_task_group_id=( SELECT cycle_task_group_id FROM cycle_task_group_objects WHERE id=cycle_task_group_object_tasks.cycle_task_group_object_id ) """) op.create_foreign_key( "cycle_task_group_id", "cycle_task_group_object_tasks", "cycle_task_groups", ["cycle_task_group_id"], ["id"] )
def upgrade(): connection = op.get_bind() op.add_column('info_touristique', GeometryExtensionColumn('infotour_location', Geometry(dimension=2, srid=3447))) infotouristique = InfoTouristique.__table__ query = sa.select([infotouristique.c.infotour_pk, infotouristique.c.infotour_gps_lat, infotouristique.c.infotour_gps_long]) query.append_whereclause(sa.and_(infotouristique.c.infotour_gps_lat != None, infotouristique.c.infotour_gps_long != None)) infos = connection.execute(query).fetchall() i = 0 pbar = progressbar.ProgressBar(widgets=[progressbar.Percentage(), progressbar.Bar()], maxval=len(infos)).start() for info in infos: point = 'POINT(%s %s)' % (info.infotour_gps_long, info.infotour_gps_lat) point = geoalchemy.base.WKTSpatialElement(point, srid=3447) op.execute( infotouristique.update(). where(infotouristique.c.infotour_pk == info.infotour_pk). values({'infotour_location': point})) pbar.update(i) i += 1 pbar.finish()
def upgrade(): resource_type = op.create_table( 'resource_type', sa.Column('name', sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint('name'), mysql_charset='utf8', mysql_engine='InnoDB' ) resource = sa.Table('resource', sa.MetaData(), type_string_col("type", "resource")) op.execute(resource_type.insert().from_select( ['name'], sa.select([resource.c.type]).distinct())) for table in ["resource", "resource_history"]: op.alter_column(table, "type", new_column_name="old_type", existing_type=type_enum) op.add_column(table, type_string_col("type", table)) sa_table = sa.Table(table, sa.MetaData(), type_string_col("type", table), type_enum_col('old_type')) op.execute(sa_table.update().values( {sa_table.c.type: sa_table.c.old_type})) op.drop_column(table, "old_type") op.alter_column(table, "type", nullable=False, existing_type=type_string)
def upgrade(): op.add_column(ROUTER_L3_AGENT_BINDING, sa.Column('binding_index', sa.Integer(), nullable=False, server_default='1')) bindings_table = sa.Table( ROUTER_L3_AGENT_BINDING, sa.MetaData(), sa.Column('router_id', sa.String(36)), sa.Column('l3_agent_id', sa.String(36)), sa.Column('binding_index', sa.Integer, nullable=False, server_default='1'), ) routers_to_bindings = defaultdict(list) session = sa.orm.Session(bind=op.get_bind()) with session.begin(subtransactions=True): for result in session.query(bindings_table): routers_to_bindings[result.router_id].append(result) for bindings in routers_to_bindings.values(): for index, result in enumerate(bindings): session.execute(bindings_table.update().values( binding_index=index + 1).where( bindings_table.c.router_id == result.router_id).where( bindings_table.c.l3_agent_id == result.l3_agent_id)) session.commit() op.create_unique_constraint( 'uniq_router_l3_agent_binding0router_id0binding_index0', ROUTER_L3_AGENT_BINDING, ['router_id', 'binding_index'])
def upgrade(): op.add_column("umbrella_organisation_oraganisation_associations", sa.Column('id', sa.Integer(), primary_key = True)) op.create_unique_constraint( "umbrella_organisation_oraganisation_associations_unique_key", "umbrella_organisation_oraganisation_associations", ["organisation_id", "umbrella_organisation_id"] )
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('relationships', sa.Column('followed_by_id', sa.Integer(), nullable=True)) op.add_column('relationships', sa.Column('user_id', sa.Integer(), nullable=True)) op.create_unique_constraint('unique_idx_user_id_followed_by_id', 'relationships', ['user_id', 'followed_by_id']) op.create_foreign_key(None, 'relationships', 'users', ['followed_by_id'], ['id']) op.create_foreign_key(None, 'relationships', 'users', ['user_id'], ['id'])
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('about_me', sa.Text(), nullable=True)) op.add_column('users', sa.Column('last_seen', sa.DateTime(), nullable=True)) op.add_column('users', sa.Column('location', sa.String(length=64), nullable=True)) op.add_column('users', sa.Column('member_since', sa.DateTime(), nullable=True)) op.add_column('users', sa.Column('name', sa.String(length=64), nullable=True))
def upgrade(): # OpenStack has decided that "down" migrations are not supported. # The downgrade() method has been omitted for this reason. op.add_column('listener_statistics', sa.Column('amphora_id', sa.String(36), nullable=False) ) op.drop_constraint('fk_listener_statistics_listener_id', 'listener_statistics', type_='foreignkey') op.drop_constraint('PRIMARY', 'listener_statistics', type_='primary') op.create_primary_key('pk_listener_statistics', 'listener_statistics', ['listener_id', 'amphora_id']) op.create_foreign_key('fk_listener_statistics_listener_id', 'listener_statistics', 'listener', ['listener_id'], ['id']) op.create_foreign_key('fk_listener_statistic_amphora_id', 'listener_statistics', 'amphora', ['amphora_id'], ['id'])
def upgrade(): ''' Add the _reactions column to table issue_comments. ''' op.add_column( 'issue_comments', sa.Column('_reactions', sa.Text, nullable=True) )
def upgrade(): """ Add next_check and last_check columns to the projects table. """ op.add_column( "projects", sa.Column( "last_check", sa.TIMESTAMP(timezone=True), default=arrow.utcnow().datetime, server_default=sa.func.current_timestamp(), ), ) op.add_column( "projects", sa.Column( "next_check", sa.TIMESTAMP(timezone=True), default=arrow.utcnow().datetime, server_default=sa.func.current_timestamp(), ), ) op.create_index( op.f("ix_projects_last_check"), "projects", ["last_check"], unique=False ) op.create_index( op.f("ix_projects_next_check"), "projects", ["next_check"], unique=False )
def upgrade(): op.add_column('secrets', sa.Column('project_id', sa.String(length=36), nullable=True)) op.create_index(op.f('ix_secrets_project_id'), 'secrets', ['project_id'], unique=False) op.create_foreign_key('secrets_project_fk', 'secrets', 'projects', ['project_id'], ['id'])
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('Nickname', mysql.VARCHAR(length=100), nullable=True)) op.drop_constraint(None, 'users', type_='unique') op.create_index('Nickname', 'users', ['Nickname'], unique=True) op.drop_column('users', 'nickname')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('post', sa.Column('title', sa.String(length=50), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('confirmed', sa.Boolean(), nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('menutem', sa.Column('isuse', mysql.CHAR(length=1), nullable=False)) op.drop_column('menu', 'isuse')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('attribute', sa.Column('format', sa.String(length=100), nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column("stocks", sa.Column("buy", sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_constraint("unique_stock", "stocks", type_="unique") op.create_unique_constraint("unique_stock", "stocks", ["ticker", "buy", "user_id"]) op.drop_column("stocks", "mode")
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column("stocks", sa.Column("mode", sa.String(length=4), nullable=True)) op.drop_constraint("unique_stock", "stocks", type_="unique") op.create_unique_constraint("unique_stock", "stocks", ["ticker", "mode", "user_id"]) op.drop_column("stocks", "buy")
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('project_classes', sa.Column('uses_supervisor', sa.Boolean(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('user', sa.Column('avatar', sa.String(length=256), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('nickname', sa.String(length=100), nullable=True)) op.drop_index('Nickname', table_name='users') op.create_unique_constraint(None, 'users', ['nickname']) op.drop_column('users', 'Nickname')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('courses', sa.Column('instructor_id', sa.Integer(), nullable=False))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('task', sa.Column('has_changed', sa.Boolean(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( "user", sa.Column("first_name", sa.String(length=200), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('todos', sa.Column('completed', sa.Boolean(), nullable=False))
def upgrade(): if 1: op.create_table('categories', sa.Column('category_id', sa.Integer(), nullable=False), sa.Column('value', sa.Text(), nullable=False), sa.Column('name', sa.Text(), nullable=True), sa.Column('fallbacks', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('category_id'), sa.UniqueConstraint('category_id'), mysql_character_set='utf8mb4' ) op.add_column('components', sa.Column('category_id', sa.Integer(), nullable=True)) op.create_foreign_key('components_ibfk_3', 'components', 'categories', ['category_id'], ['category_id']) db.session.commit() if 1: #db.session.add(Category(value='', name='Unknown')) db.session.add(Category(value='X-System', name='System Update')) db.session.add(Category(value='X-Device', name='Device Update')) db.session.add(Category(value='X-EmbeddedController', name='Embedded Controller Update')) db.session.add(Category(value='X-ManagementEngine', name='Management Engine Update')) db.session.add(Category(value='X-Controller', name='Controller Update')) db.session.commit() # convert the existing components apxs = {} for cat in db.session.query(Category): apxs[cat.value] = cat for md in db.session.query(Component): # already set if md.category_id: continue # find suffix for apx_value in apxs: cat = apxs[apx_value] for suffix in ['System Update', 'System Firmware', 'BIOS']: if md.name.endswith(suffix) or md.summary.endswith(suffix): md.category_id = apxs['X-System'].category_id break for suffix in ['Embedded Controller', 'Embedded controller']: if md.name.endswith(suffix) or md.summary.endswith(suffix): md.category_id = apxs['X-System'].category_id break for suffix in ['ME Firmware']: if md.name.endswith(suffix) or md.summary.endswith(suffix): md.category_id = apxs['X-ManagementEngine'].category_id break for suffix in ['controller Update']: if md.name.endswith(suffix) or md.summary.endswith(suffix): md.category_id = apxs['X-Controller'].category_id break # protocol fallback if not md.category_id: if md.protocol and md.protocol.value in ['org.flashrom', 'org.uefi.capsule', 'org.uefi.capsule']: md.category_id = apxs['X-System'].category_id else: md.category_id = apxs['X-Device'].category_id # fix component name name_new = _fix_component_name(md.name, md.developer_name_display) if md.name != name_new: print('Fixing %s->%s' % (md.name, name_new)) md.name = name_new else: print('Ignoring %s' % md.name) # all done db.session.commit()
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( "task", sa.Column("source_require_sql_output", sa.Integer(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('release_monitor', sa.Column('activated', sa.Boolean(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('email', sa.String(length=255), nullable=True)) op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column("custom_action", sa.Column("is_ajax", sa.Boolean(), nullable=True))
def upgrade(): op.add_column('post', sa.Column('bumped', sa.Boolean)) table = sql.table('post', sql.column('bumped')) op.execute(table.update().values(bumped=True)) op.alter_column('post', 'bumped', nullable=False) op.create_index(None, 'post', ['bumped'])
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('user', sa.Column('active_status', sa.SmallInteger(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column("game", sa.Column("max_players", sa.Integer(), nullable=True)) op.add_column("game", sa.Column("min_players", sa.Integer(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('front_user', sa.Column('avatars', sa.String(length=200), nullable=True)) op.drop_column('front_user', 'avatar')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('markers_no_location', sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=100), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('provider_and_id', sa.BigInteger(), nullable=True), sa.Column('provider_code', sa.Integer(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('subtype', sa.Integer(), nullable=True), sa.Column('severity', sa.Integer(), nullable=True), sa.Column('address', sa.Text(), nullable=True), sa.Column('locationAccuracy', sa.Integer(), nullable=True), sa.Column('roadType', sa.Integer(), nullable=True), sa.Column('roadShape', sa.Integer(), nullable=True), sa.Column('dayType', sa.Integer(), nullable=True), sa.Column('unit', sa.Integer(), nullable=True), sa.Column('mainStreet', sa.Text(), nullable=True), sa.Column('secondaryStreet', sa.Text(), nullable=True), sa.Column('junction', sa.Text(), nullable=True), sa.Column('one_lane', sa.Integer(), nullable=True), sa.Column('multi_lane', sa.Integer(), nullable=True), sa.Column('speed_limit', sa.Integer(), nullable=True), sa.Column('intactness', sa.Integer(), nullable=True), sa.Column('road_width', sa.Integer(), nullable=True), sa.Column('road_sign', sa.Integer(), nullable=True), sa.Column('road_light', sa.Integer(), nullable=True), sa.Column('road_control', sa.Integer(), nullable=True), sa.Column('weather', sa.Integer(), nullable=True), sa.Column('road_surface', sa.Integer(), nullable=True), sa.Column('road_object', sa.Integer(), nullable=True), sa.Column('object_distance', sa.Integer(), nullable=True), sa.Column('didnt_cross', sa.Integer(), nullable=True), sa.Column('cross_mode', sa.Integer(), nullable=True), sa.Column('cross_location', sa.Integer(), nullable=True), sa.Column('cross_direction', sa.Integer(), nullable=True), sa.Column('video_link', sa.Text(), nullable=True), sa.Column('road1', sa.Integer(), nullable=True), sa.Column('road2', sa.Integer(), nullable=True), sa.Column('km', sa.Float(), nullable=True), sa.Column('yishuv_symbol', sa.Integer(), nullable=True), sa.Column('geo_area', sa.Integer(), nullable=True), sa.Column('day_night', sa.Integer(), nullable=True), sa.Column('day_in_week', sa.Integer(), nullable=True), sa.Column('traffic_light', sa.Integer(), nullable=True), sa.Column('region', sa.Integer(), nullable=True), sa.Column('district', sa.Integer(), nullable=True), sa.Column('natural_area', sa.Integer(), nullable=True), sa.Column('minizipali_status', sa.Integer(), nullable=True), sa.Column('yishuv_shape', sa.Integer(), nullable=True), sa.Column('street1', sa.Integer(), nullable=True), sa.Column('street2', sa.Integer(), nullable=True), sa.Column('home', sa.Integer(), nullable=True), sa.Column('urban_intersection', sa.Integer(), nullable=True), sa.Column('non_urban_intersection', sa.Integer(), nullable=True), sa.Column('accident_year', sa.Integer(), nullable=True), sa.Column('accident_month', sa.Integer(), nullable=True), sa.Column('accident_day', sa.Integer(), nullable=True), sa.Column('accident_hour_raw', sa.Integer(), nullable=True), sa.Column('accident_hour', sa.Integer(), nullable=True), sa.Column('accident_minute', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id', 'provider_code') ) op.create_index('id_idx_markers_no_location', 'markers_no_location', ['id'], unique=False) op.create_index(op.f('ix_markers_no_location_created'), 'markers_no_location', ['created'], unique=False) op.create_index('provider_and_id_idx_markers_no_location', 'markers_no_location', ['provider_and_id'], unique=True) op.create_table('involved_no_location', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('provider_and_id', sa.BigInteger(), nullable=True), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.BigInteger(), nullable=True), sa.Column('involved_type', sa.Integer(), nullable=True), sa.Column('license_acquiring_date', sa.Integer(), nullable=True), sa.Column('age_group', sa.Integer(), nullable=True), sa.Column('sex', sa.Integer(), nullable=True), sa.Column('car_type', sa.Integer(), nullable=True), sa.Column('safety_measures', sa.Integer(), nullable=True), sa.Column('involve_yishuv_symbol', sa.Integer(), nullable=True), sa.Column('injury_severity', sa.Integer(), nullable=True), sa.Column('injured_type', sa.Integer(), nullable=True), sa.Column('injured_position', sa.Integer(), nullable=True), sa.Column('population_type', sa.Integer(), nullable=True), sa.Column('home_region', sa.Integer(), nullable=True), sa.Column('home_district', sa.Integer(), nullable=True), sa.Column('home_natural_area', sa.Integer(), nullable=True), sa.Column('home_municipal_status', sa.Integer(), nullable=True), sa.Column('home_residence_type', sa.Integer(), nullable=True), sa.Column('hospital_time', sa.Integer(), nullable=True), sa.Column('medical_type', sa.Integer(), nullable=True), sa.Column('release_dest', sa.Integer(), nullable=True), sa.Column('safety_measures_use', sa.Integer(), nullable=True), sa.Column('late_deceased', sa.Integer(), nullable=True), sa.Column('car_id', sa.Integer(), nullable=True), sa.Column('involve_id', sa.Integer(), nullable=True), sa.Column('accident_year', sa.Integer(), nullable=True), sa.Column('accident_month', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers_no_location.id', u'markers_no_location.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_index('accident_id_idx_involved_no_location', 'involved_no_location', ['accident_id'], unique=False) op.create_index('provider_and_id_idx_involved_no_location', 'involved_no_location', ['provider_and_id'], unique=False) op.create_table('vehicles_no_location', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('provider_and_id', sa.BigInteger(), nullable=True), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.BigInteger(), nullable=True), sa.Column('engine_volume', sa.Integer(), nullable=True), sa.Column('manufacturing_year', sa.Integer(), nullable=True), sa.Column('driving_directions', sa.Integer(), nullable=True), sa.Column('vehicle_status', sa.Integer(), nullable=True), sa.Column('vehicle_attribution', sa.Integer(), nullable=True), sa.Column('vehicle_type', sa.Integer(), nullable=True), sa.Column('seats', sa.Integer(), nullable=True), sa.Column('total_weight', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers_no_location.id', u'markers_no_location.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_index('accident_id_idx_vehicles_no_location', 'vehicles_no_location', ['accident_id'], unique=False) op.create_index('provider_and_id_idx_vehicles_no_location', 'vehicles_no_location', ['provider_and_id'], unique=False) op.add_column(u'involved', sa.Column('accident_month', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('accident_year', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('car_id', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('home_natural_area', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('home_region', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('involve_id', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('involve_yishuv_symbol', sa.Integer(), nullable=True)) op.add_column(u'involved', sa.Column('provider_and_id', sa.BigInteger(), nullable=True)) op.create_index('provider_and_id_idx_involved', 'involved', ['provider_and_id'], unique=False) op.drop_column(u'involved', 'home_area') op.drop_column(u'involved', 'home_city') op.drop_column(u'involved', 'home_nafa') op.add_column(u'markers', sa.Column('accident_day', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('accident_hour', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('accident_hour_raw', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('accident_minute', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('accident_month', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('accident_year', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('home', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('non_urban_intersection', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('provider_and_id', sa.BigInteger(), nullable=True)) op.add_column(u'markers', sa.Column('street1', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('street2', sa.Integer(), nullable=True)) op.add_column(u'markers', sa.Column('urban_intersection', sa.Integer(), nullable=True)) op.create_index('provider_and_id_idx_markers', 'markers', ['provider_and_id'], unique=True) op.drop_index('id_idx_markers', table_name='markers') op.create_index('id_idx_markers', 'markers', ['id'], unique=False) op.add_column(u'vehicles', sa.Column('provider_and_id', sa.BigInteger(), nullable=True)) op.create_index('provider_and_id_idx_vehicles', 'vehicles', ['provider_and_id'], unique=False)
def upgrade(): op.add_column('users', sa.Column('login', sa.String(length=63), nullable=False)) op.create_unique_constraint(None, 'users', ['login'])
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('front_user', sa.Column('avatar', mysql.VARCHAR(length=50), nullable=True)) op.drop_column('front_user', 'avatars')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('uuidd', sa.VARCHAR(length=36), autoincrement=False, nullable=True)) op.drop_constraint(None, 'users', type_='unique') op.create_unique_constraint('users_uuidd_key', 'users', ['uuidd']) op.drop_column('users', 'uuid')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('pages', sa.Column('path', sa.Unicode(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('uuid', sa.String(length=36), nullable=True)) op.drop_constraint('users_uuidd_key', 'users', type_='unique') op.create_unique_constraint(None, 'users', ['uuid']) op.drop_column('users', 'uuidd')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('artists', sa.Column('seeking_description', sa.String(), nullable=True)) op.add_column('artists', sa.Column('seeking_venue', sa.Boolean(), nullable=False)) op.add_column('venues', sa.Column('seeking_description', sa.String(), nullable=True)) op.add_column('venues', sa.Column('seeking_talent', sa.Boolean(), nullable=False))