How to use the alembic.op.f function in alembic

To help you get started, we’ve selected a few alembic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intel-ctrlsys / sensys / contrib / database / schema_migration / versions / 241f4694b528_initial_version.py View on Github external
sa.Column('start_time', sa.DateTime()),
        sa.Column('end_time', sa.DateTime()),
        sa.Column('energy_usage', sa.Float()),
        sa.Column('exit_status', sa.Integer()),
        sa.PrimaryKeyConstraint('job_id', name=op.f('pk_job')))
    op.create_table('node',
        sa.Column('node_id', sa.Integer(), autoincrement=True, unique=True, nullable=False),
        sa.Column('hostname', sa.String(length=256), nullable=False),
        sa.Column('node_type', sa.SmallInteger()),
        sa.Column('status', sa.SmallInteger()),
        sa.Column('num_cpus', sa.SmallInteger()),
        sa.Column('num_sockets', sa.SmallInteger()),
        sa.Column('cores_per_socket', sa.SmallInteger()),
        sa.Column('threads_per_core', sa.SmallInteger()),
        sa.Column('memory', sa.SmallInteger()),
        sa.PrimaryKeyConstraint('node_id', name=op.f('pk_node')),
        sa.UniqueConstraint('hostname', name=op.f('uq_node_hostname')))
    op.create_table('test_result',
        sa.Column('test_result_id', sa.Integer(), autoincrement=True, unique=True, nullable=False),
        sa.Column('name', sa.String(length=250), nullable=False),
        sa.PrimaryKeyConstraint('test_result_id', name=op.f('pk_test_result')),
        sa.UniqueConstraint('name', name=op.f('uq_test_result_name')))
    op.create_table('data_item',
        sa.Column('data_item_id', sa.Integer(), autoincrement=True, unique=True, nullable=False),
        sa.Column('name', sa.String(length=250), nullable=False),
        sa.Column('data_type_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['data_type_id'], ['data_type.data_type_id'], name=op.f('fk_data_item_data_type_id_data_type')),
        sa.PrimaryKeyConstraint('data_item_id', name=op.f('pk_data_item')),
        sa.UniqueConstraint('name', name=op.f('uq_data_item_name')))
    op.create_table('diag',
        sa.Column('diag_type_id', sa.Integer(), nullable=False),
        sa.Column('diag_subtype_id', sa.Integer(), nullable=False),
github cloudify-cosmo / cloudify-manager / resources / rest-service / cloudify / migrations / versions / 62a8d746d13b_5_0_to_5_0_5.py View on Github external
table_name='deployment_update_steps',
    )
    op.drop_index(
        op.f('deployment_update_steps__deployment_update_fk_idx'),
        table_name='deployment_update_steps',
    )
    op.drop_index(
        op.f('deployment_update_steps__creator_id_idx'),
        table_name='deployment_update_steps',
    )
    op.drop_index(
        op.f('deployment_modifications_visibility_idx'),
        table_name='deployment_modifications',
    )
    op.drop_index(
        op.f('deployment_modifications__deployment_fk_idx'),
        table_name='deployment_modifications',
    )
    op.drop_index(
        op.f('deployment_modifications__creator_id_idx'),
        table_name='deployment_modifications',
    )
    op.drop_index(op.f('config__updater_id_idx'), table_name='config')
    op.drop_index(
        op.f('certificates__updater_id_idx'), table_name='certificates'
    )
    op.drop_index(op.f('blueprints_visibility_idx'), table_name='blueprints')
    op.drop_index(op.f('blueprints__creator_id_idx'), table_name='blueprints')
    op.drop_index(op.f('agents_visibility_idx'), table_name='agents')
    op.drop_index(op.f('agents__node_instance_fk_idx'), table_name='agents')
    op.drop_index(op.f('agents__creator_id_idx'), table_name='agents')
    op.drop_index(op.f('executions_token_idx'), table_name='executions')
github OriginProtocol / origin / database / migrations / versions / 12dac0fc84c8_add_eth_notification_endpoint.py View on Github external
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        op.f('ix_eth_notification_endpoint_eth_address'),
        table_name='eth_notification_endpoint')
    op.drop_index(
        op.f('ix_eth_notification_endpoint_device_token'),
        table_name='eth_notification_endpoint')
    op.drop_table('eth_notification_endpoint')
    # ### end Alembic commands ###
github indico / indico / migrations / versions / 201508041718_2a595947d232_add_event_menu_related_tables.py View on Github external
name=op.f('fk_menu_entries_parent_id_menu_entries')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_menu_entries')),
        sa.UniqueConstraint('event_id', 'position', 'parent_id', name=u'uix_position_per_event'),
        schema='events'
    )
    op.create_index(op.f('ix_menu_entries_event_id'), 'menu_entries', ['event_id'], unique=False, schema='events')
    op.create_index(op.f('ix_menu_entries_parent_id'), 'menu_entries', ['parent_id'], unique=False, schema='events')
    op.create_index('uix_name_per_event', 'menu_entries', ['event_id', 'name'], unique=True, schema='events',
                    postgresql_where=sa.text('(type = 2 OR type = 4)'))
    op.create_table(
        'menu_pages',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('menu_entry_id', sa.Integer(), nullable=False),
        sa.Column('html', sa.Text(), nullable=False),
        sa.ForeignKeyConstraint(['menu_entry_id'], [u'events.menu_entries.id'],
                                name=op.f('fk_menu_pages_menu_entry_id_menu_entries')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_menu_pages')),
        schema='events'
    )
    op.create_index(op.f('ix_menu_pages_menu_entry_id'), 'menu_pages', ['menu_entry_id'], unique=False, schema='events')
    op.create_foreign_key(None, 'menu_entries', 'menu_pages', ['page_id'], ['id'],
                          source_schema='events', referent_schema='events')
github OriginProtocol / origin / database / migrations / versions / 12dac0fc84c8_add_eth_notification_endpoint.py View on Github external
sa.Column('type', sa.Enum('APN', 'FCM', name='ethnotificationtypes'),
                              nullable=True),
                    sa.Column('active', sa.Boolean(), nullable=True),
                    sa.Column('verified', sa.Boolean(), nullable=True),
                    sa.Column('created_at', sa.DateTime(timezone=True),
                              server_default=sa.text('now()'), nullable=True),
                    sa.Column('expires_at', sa.DateTime(timezone=True), nullable=True),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_index(
        op.f('ix_eth_notification_endpoint_device_token'),
        'eth_notification_endpoint',
        ['device_token'],
        unique=False)
    op.create_index(
        op.f('ix_eth_notification_endpoint_eth_address'),
        'eth_notification_endpoint',
        ['eth_address'],
        unique=False)
    # ### end Alembic commands ###
github mitmedialab / CivilServant / alembic / versions / dc2328901c69_create_lumen_twitter_tables.py View on Github external
def downgrade_development():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_twitter_users_screen_name'), table_name='twitter_users')
    op.drop_index(op.f('ix_twitter_users_not_found_id'), table_name='twitter_users')
    op.drop_table('twitter_users')
    op.drop_index(op.f('ix_twitter_user_snapshots_twitter_user_id'), table_name='twitter_user_snapshots')
    op.drop_index(op.f('ix_twitter_user_snapshots_twitter_not_found_id'), table_name='twitter_user_snapshots')
    op.drop_table('twitter_user_snapshots')
    op.drop_index(op.f('ix_twitter_statuses_user_id'), table_name='twitter_statuses')
    op.drop_table('twitter_statuses')
    op.drop_table('lumen_notices')
    op.drop_index(op.f('ix_lumen_notice_to_twitter_user_twitter_username'), table_name='lumen_notice_to_twitter_user')
    op.drop_index(op.f('ix_lumen_notice_to_twitter_user_twitter_user_id'), table_name='lumen_notice_to_twitter_user')
    op.drop_index(op.f('ix_lumen_notice_to_twitter_user_notice_id'), table_name='lumen_notice_to_twitter_user')
    op.drop_table('lumen_notice_to_twitter_user')
    # ### end Alembic commands ###
github fedspendingtransparency / data-act-broker-backend / dataactcore / migrations / versions / 60830f0881a5_remove_funding_agency_code_and_fiscal_.py View on Github external
def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('detached_award_financial_assistance', sa.Column('funding_agency_code', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('detached_award_financial_assistance', sa.Column('fiscal_year_and_quarter_co', sa.TEXT(), autoincrement=False, nullable=True))
    op.create_index(op.f('ix_detached_award_financial_assistance_funding_agency_code'), 'detached_award_financial_assistance', ['funding_agency_code'], unique=False)
    ### end Alembic commands ###
github cloudify-cosmo / cloudify-manager / resources / rest-service / cloudify / migrations / versions / 730403566523_4_1.py View on Github external
'groups',
        ['name'],
        unique=True)
    op.create_index(
        op.f('logs_id_idx'),
        'logs',
        ['id'],
        unique=False)
    op.create_index(
        op.f('logs_timestamp_idx'),
        'logs',
        ['timestamp'],
        unique=False)
    op.drop_index('ix_logs_timestamp', table_name='logs')
    op.create_index(
        op.f('node_instances_id_idx'),
        'node_instances',
        ['id'],
        unique=False)
    op.create_index(
        op.f('nodes_id_idx'),
        'nodes',
        ['id'],
        unique=False)
    op.create_index(
        op.f('nodes_type_idx'),
        'nodes',
        ['type'],
        unique=False)
    op.create_index(
        op.f('plugins_archive_name_idx'),
        'plugins',
github kasheemlew / learn-python / flask-ex / migrations / versions / 8f68f88e13ec_.py View on Github external
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_comments_timestamp'), table_name='comments')
    op.drop_table('comments')
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_table('follows')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_index(op.f('ix_roles_default'), table_name='roles')
    op.drop_table('roles')
    ### end Alembic commands ###
github quantifiedcode / checkmate / checkmate / migrations / versions / 14361ae029cf_initial_db_layout.py View on Github external
sa.Column('tree_sha', sa.VARCHAR(length=60), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('committer_date', sa.DateTime(), nullable=True),
    sa.Column('author_name', sa.VARCHAR(length=60), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('sha', sa.VARCHAR(length=60), nullable=True),
    sa.Column('snapshot', sa.VARCHAR(length=60), nullable=True),
    sa.Column('author_date_ts', sa.Integer(), nullable=True),
    sa.Column('author_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['snapshot'], ['snapshot.pk'], name='gitsnapshot_snapshot_snapshot', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('pk'),
    sa.UniqueConstraint('snapshot', name='unique_gitsnapshot_snapshot')
    )
    op.create_index(op.f('ix_gitsnapshot_author_date'), 'gitsnapshot', ['author_date'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_author_date_ts'), 'gitsnapshot', ['author_date_ts'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_committer_date'), 'gitsnapshot', ['committer_date'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_committer_date_ts'), 'gitsnapshot', ['committer_date_ts'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_created_at'), 'gitsnapshot', ['created_at'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_pk'), 'gitsnapshot', ['pk'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_sha'), 'gitsnapshot', ['sha'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_snapshot'), 'gitsnapshot', ['snapshot'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_tree_sha'), 'gitsnapshot', ['tree_sha'], unique=False)
    op.create_index(op.f('ix_gitsnapshot_updated_at'), 'gitsnapshot', ['updated_at'], unique=False)
    op.create_table('issueoccurrence',
    sa.Column('data', sa.LargeBinary(), nullable=True),
    sa.Column('pk', sa.VARCHAR(length=60), nullable=False),
    sa.Column('sequence', sa.Integer(), nullable=True),
    sa.Column('to_column', sa.Integer(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('to_row', sa.Integer(), nullable=True),
    sa.Column('file_revision', sa.VARCHAR(length=60), nullable=True),