Python sqlalchemy.ForeignKeyConstraint() Examples

The following are code examples for showing how to use sqlalchemy.ForeignKeyConstraint(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: podigger   Author: perna   File: 012722a93d11_.py    (license) View Source Project 7 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('topic_suggestion',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('title', sa.String(), nullable=False),
    sa.Column('description', sa.Text(), nullable=True),
    sa.Column('is_recorded', sa.Boolean(), nullable=False),
    sa.Column('podcast_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['podcast_id'], ['podcast.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_topic_suggestion_id'), 'topic_suggestion', ['id'], unique=False)
    op.create_index(op.f('ix_topic_suggestion_title'), 'topic_suggestion', ['title'], unique=False)
    op.create_index(op.f('ix_episode_id'), 'episode', ['id'], unique=False)
    op.create_index(op.f('ix_podcast_id'), 'podcast', ['id'], unique=False)
    op.create_index(op.f('ix_popular_term_id'), 'popular_term', ['id'], unique=False)
    op.create_index(op.f('ix_tag_id'), 'tag', ['id'], unique=False)
    ### end Alembic commands ### 
Example 2
Project: flask-react-redux-demo   Author: eddowh   File: 873b2c69b9cd_restaurants_models_init.py    (license) View Source Project 7 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('restaurants_restaurant',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=250), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('restaurants_menuitem',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('description', sa.Text(), nullable=True),
    sa.Column('price', sa.Numeric(precision=2), nullable=False),
    sa.Column('course', sa.String(length=250), nullable=True),
    sa.Column('restaurant_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['restaurant_id'], ['restaurants_restaurant.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 3
Project: fabric8-analytics-server   Author: fabric8-analytics   File: 963d3d929b19_analyses.py    (license) View Source Project 7 votes vote down vote up
def upgrade():
    """Upgrade the database to a newer revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.create_table('analyses',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('ecosystem', sa.Integer(), nullable=True),
                    sa.Column('package', sa.String(length=255), nullable=True),
                    sa.Column('version', sa.String(length=255), nullable=True),
                    sa.Column('access_count', sa.Integer(), nullable=True),
                    sa.Column('started_at', sa.DateTime(), nullable=True),
                    sa.Column('finished_at', sa.DateTime(), nullable=True),
                    sa.Column('analyses', postgresql.JSONB(), nullable=True),
                    sa.Column('subtasks', postgresql.JSONB(), nullable=True),
                    sa.Column('release', sa.String(length=255), nullable=True),
                    sa.Column('audit', postgresql.JSONB(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('worker_results',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('worker', sa.String(length=255), nullable=True),
                    sa.Column('analysis_id', sa.Integer(), nullable=True),
                    sa.Column('task_result', postgresql.JSONB(), nullable=True),
                    sa.ForeignKeyConstraint(['analysis_id'], ['analyses.id'], ),
                    sa.PrimaryKeyConstraint('id'))
    # end Alembic commands ### 
Example 4
Project: bit   Author: codesmart-co   File: 4ad33f99723a_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('bit_facebook_daily_ad_insights_impression_device',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('account_id', sa.String(length=255), nullable=True),
    sa.Column('campaign_id', sa.String(length=255), nullable=True),
    sa.Column('adset_id', sa.String(length=255), nullable=True),
    sa.Column('campaign_name', sa.String(length=255), nullable=True),
    sa.Column('spend', sa.Numeric(), nullable=True),
    sa.Column('cost_per_unique_click', sa.Numeric(), nullable=True),
    sa.Column('unique_clicks', sa.Integer(), nullable=True),
    sa.Column('unique_impressions', sa.Integer(), nullable=True),
    sa.Column('unique_social_clicks', sa.Integer(), nullable=True),
    sa.Column('unique_social_impressions', sa.Integer(), nullable=True),
    sa.Column('website_clicks', sa.Integer(), nullable=True),
    sa.Column('date_start', sa.DateTime(), nullable=True),
    sa.Column('date_stop', sa.DateTime(), nullable=True),
    sa.Column('impression_device', sa.String(length=255), nullable=True),
    sa.Column('ad_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['ad_id'], ['bit_facebook_ad.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_bit_facebook_daily_ad_insights_impression_device_impression_device'), 'bit_facebook_daily_ad_insights_impression_device', ['impression_device'], unique=False)
    # ### end Alembic commands ### 
Example 5
Project: Leics   Author: LeicsFrameWork   File: 948333640f64_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('default', sa.Boolean(), nullable=True),
    sa.Column('permissions', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=164), nullable=True),
    sa.Column('email', sa.String(length=164), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.Column('password_hash', sa.String(length=164), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    ### end Alembic commands ### 
Example 6
Project: podigger   Author: perna   File: 5c5dc0258b2f_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('episode',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(), nullable=False),
    sa.Column('link', sa.String(), nullable=False),
    sa.Column('description', sa.Text(), nullable=True),
    sa.Column('published', sa.DateTime(), nullable=True),
    sa.Column('enclosure', sa.String(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('podcast_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['podcast_id'], ['podcast.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('link'),
    sa.UniqueConstraint('title')
    )
    op.create_index(op.f('ix_podcast_feed'), 'podcast', ['feed'], unique=True)
    op.create_index(op.f('ix_podcast_name'), 'podcast', ['name'], unique=True)
    ### end Alembic commands ### 
Example 7
Project: podigger   Author: perna   File: 34d97cbc759e_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('role',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=True),
    sa.Column('description', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('active', sa.Boolean(), nullable=True),
    sa.Column('confirmed_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('roles_users',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    ### end Alembic commands ### 
Example 8
Project: zun   Author: openstack   File: b6bfca998431_add_container_actions_events_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'container_actions_events',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('event', sa.String(length=255), nullable=True),
        sa.Column('action_id', sa.Integer(), nullable=False),
        sa.Column('start_time', sa.DateTime(), nullable=True),
        sa.Column('finish_time', sa.DateTime(), nullable=True),
        sa.Column('result', sa.String(length=255), nullable=True),
        sa.Column('traceback', sa.Text(), nullable=True),
        sa.Column('details', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(['action_id'], ['container_actions.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
Example 9
Project: pyt   Author: python-security   File: 514ca0a3282c_private_messages.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('privatemessages',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), nullable=False),
    sa.Column('from_user_id', sa.INTEGER(), nullable=True),
    sa.Column('to_user_id', sa.INTEGER(), nullable=True),
    sa.Column('subject', sa.VARCHAR(length=255), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('date_created', sa.DATETIME(), nullable=True),
    sa.Column('trash', sa.BOOLEAN(), nullable=False),
    sa.Column('draft', sa.BOOLEAN(), nullable=False),
    sa.Column('unread', sa.BOOLEAN(), nullable=False),
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('messages')
    op.drop_table('conversations')
    ### end Alembic commands ### 
Example 10
Project: pyt   Author: python-security   File: 514ca0a3282c_private_messages.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('privatemessages',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), nullable=False),
    sa.Column('from_user_id', sa.INTEGER(), nullable=True),
    sa.Column('to_user_id', sa.INTEGER(), nullable=True),
    sa.Column('subject', sa.VARCHAR(length=255), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('date_created', sa.DATETIME(), nullable=True),
    sa.Column('trash', sa.BOOLEAN(), nullable=False),
    sa.Column('draft', sa.BOOLEAN(), nullable=False),
    sa.Column('unread', sa.BOOLEAN(), nullable=False),
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('messages')
    op.drop_table('conversations')
    ### end Alembic commands ### 
Example 11
Project: flasky   Author: RoseOu   File: 51f5ccfba190_comments.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_comments_timestamp', 'comments', ['timestamp'], unique=False)
    ### end Alembic commands ### 
Example 12
Project: flasky   Author: RoseOu   File: 38c4e85512a9_initial_migration.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_users_username', 'users', ['username'], unique=True)
    ### end Alembic commands ### 
Example 13
Project: GWMMS   Author: lvhuiyang   File: 99581cf675e3_initial_migration.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.Column('confirmed', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.drop_table('Products')
    ### end Alembic commands ### 
Example 14
Project: kuberdock-platform   Author: cloudlinux   File: 53489a9c1e2d_usage_ip_states_and_pd_states.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('pd_states',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('pd_name', sa.String(), nullable=False),
                    sa.Column('size', sa.Integer(), nullable=False),
                    sa.Column('start_time', sa.DateTime(), nullable=False),
                    sa.Column('end_time', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(['user_id'], ['users.id']),
                    sa.PrimaryKeyConstraint('start_time'))
    op.create_table('ip_states',
                    sa.Column('pod_id', postgresql.UUID(), nullable=False),
                    sa.Column('ip_address', sa.BigInteger(), nullable=False),
                    sa.Column('start_time', sa.DateTime(), nullable=False),
                    sa.Column('end_time', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(['pod_id'], ['pods.id']),
                    sa.PrimaryKeyConstraint('pod_id', 'start_time')) 
Example 15
Project: kuberdock-platform   Author: cloudlinux   File: 241a7b04a9ff_add_menurole_rm_pages.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('menuitem_roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('menuitem_id', sa.Integer(), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['menuitem_id'], ['menus_items.id'], ),
    sa.ForeignKeyConstraint(['role_id'], ['rbac_role.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_constraint(u'menus_created_by_id_fkey', 'menus', type_='foreignkey')
    op.drop_column('menus', 'created_by_id')
    op.drop_column('menus', 'ts')
    op.drop_constraint(u'menus_items_created_by_id_fkey', 'menus_items', type_='foreignkey')
    op.drop_constraint(u'menus_items_page_id_fkey', 'menus_items', type_='foreignkey')
    op.drop_column('menus_items', 'created_by_id')
    op.drop_column('menus_items', 'is_group_label')
    op.drop_column('menus_items', 'page_id')
    op.drop_column('menus_items', 'roles')
    op.drop_column('menus_items', 'ts')
    op.drop_column('menus_items', 'is_public')
    op.drop_table('pages')
    ### end Alembic commands ### 
Example 16
Project: tracker   Author: Songbee   File: 1c3bec762483_initial_migration.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('artists',
        sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
        sa.Column('name', sa.String(), nullable=True),
        sa.Column('description', sa.String(), nullable=True),
        sa.Column('search_vector', sqlalchemy_utils.types.ts_vector.TSVectorType(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table('torrents',
        sa.Column('id', sa.String(length=40), nullable=False),
        sa.Column('info', sa.PickleType(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table('albums',
        sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
        sa.Column('title', sa.String(), nullable=True),
        sa.Column('tracks', sqlalchemy_utils.types.json.JSONType(), nullable=True),
        sa.Column('search_vector', sqlalchemy_utils.types.ts_vector.TSVectorType(), nullable=True),
        sa.Column('torrent_id', sa.String(length=40), nullable=True),
        sa.Column('artist_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
        sa.ForeignKeyConstraint(['artist_id'], ['artists.id'], ),
        sa.ForeignKeyConstraint(['torrent_id'], ['torrents.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
Example 17
Project: mensa-tracker   Author: annyanich   File: db2754bfb7bc_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('social_id', sa.String(length=64), nullable=False),
    sa.Column('nickname', sa.String(length=256), nullable=False),
    sa.Column('email', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('social_id')
    )
    op.create_table('searches',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('search_terms', sa.String(length=64), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 18
Project: mensa-tracker   Author: annyanich   File: 2334ba39b028_.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('searches',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('search_terms', sa.VARCHAR(length=64), nullable=False),
    sa.Column('timestamp', sa.DATETIME(), nullable=True),
    sa.Column('user_id', sa.INTEGER(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('social_id', sa.VARCHAR(length=64), nullable=False),
    sa.Column('nickname', sa.VARCHAR(length=64), nullable=False),
    sa.Column('email', sa.VARCHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('social_id')
    )
    ### end Alembic commands ### 
Example 19
Project: mensa-tracker   Author: annyanich   File: a94bc6277195_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('social_id', sa.String(length=64), nullable=False),
    sa.Column('nickname', sa.String(length=64), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('social_id')
    )
    op.create_table('searches',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('search_terms', sa.String(length=64), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 20
Project: flask-celery3-boilerplate   Author: sdg32   File: 8c368650ca58_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('schedule_info',
    sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('last_changed_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('schedule_meta',
    sa.Column('parent_id', sa.Integer(), nullable=False),
    sa.Column('last_run_at', sa.DateTime(), nullable=True),
    sa.Column('total_run_count', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['parent_id'], ['schedule_task.id'], ),
    sa.PrimaryKeyConstraint('parent_id')
    )
    with op.batch_alter_table('schedule_task') as batch_op:
        batch_op.drop_column('total_run_count')
        batch_op.drop_column('last_run_at')
    # ### end Alembic commands ### 
Example 21
Project: ml-annotate   Author: planbrothers   File: 186247cd152e_add_user_and_userproblem.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
    sa.Column('username', sa.Unicode(length=255), nullable=False),
    sa.Column('password', sqlalchemy_utils.types.password.PasswordType(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('is_superuser', sa.Boolean(), server_default='FALSE', nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('user_problem',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
    sa.Column('problem_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
    sa.Column('user_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
    sa.ForeignKeyConstraint(['problem_id'], ['problem.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_problem_user_id'), 'user_problem', ['user_id'], unique=False)
    # ### end Alembic commands ### 
Example 22
Project: chihu   Author: yelongyu   File: 10aa37389b60_add_comments_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_comments_timestamp'), 'comments', ['timestamp'], unique=False)
    op.alter_column(u'statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ### 
Example 23
Project: dazzar   Author: Philaeux   File: 7b46ed274746_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('scoreboard',
    sa.Column('user_id', sa.BigInteger(), nullable=False),
    sa.Column('ladder_name', sa.String(), nullable=False),
    sa.Column('mmr', sa.Integer(), nullable=False),
    sa.Column('matches', sa.Integer(), server_default='0', nullable=False),
    sa.Column('win', sa.Integer(), server_default='0', nullable=False),
    sa.Column('loss', sa.Integer(), server_default='0', nullable=False),
    sa.Column('dodge', sa.Integer(), server_default='0', nullable=False),
    sa.Column('leave', sa.Integer(), server_default='0', nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('user_id', 'ladder_name')
    )
    op.create_index(op.f('ix_scoreboard_mmr'), 'scoreboard', ['mmr'], unique=False)
    op.add_column('match', sa.Column('radiant_win', sa.Boolean(), nullable=True))
    op.add_column('match', sa.Column('section', sa.String(), server_default='high', nullable=False))
    op.add_column('player_in_match', sa.Column('is_dodge', sa.Boolean(), server_default='false', nullable=False))
    op.add_column('user', sa.Column('section', sa.String(), nullable=True))
    ### end Alembic commands ### 
Example 24
Project: heutagogy-backend   Author: heutagogy   File: 797321279ea1_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=255), nullable=False),
    sa.Column('password', sa.String(), nullable=False),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('confirmed_at', sa.DateTime(), nullable=True),
    sa.Column('is_active', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('first_name', sa.String(length=255), server_default='', nullable=False),
    sa.Column('last_name', sa.String(length=255), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('username')
    )
    op.create_table('bookmark',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=False),
    sa.Column('url', sa.String(), nullable=False),
    sa.Column('title', sa.String(), nullable=False),
    sa.Column('read', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    ) 
Example 25
Project: tingsmen   Author: pasqu4le   File: 7e7eb4243802_.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'mailing_list', type_='unique')
    op.drop_column('mailing_list', 'url')
    op.create_table('email',
    sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('email_id_seq'::regclass)"), nullable=False),
    sa.Column('value', sa.VARCHAR(length=120), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name=u'email_pkey'),
    sa.UniqueConstraint('value', name=u'email_value_key'),
    postgresql_ignore_search_path=False
    )
    op.create_table('email_mailing_list',
    sa.Column('mailing_list_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('email_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['email_id'], [u'email.id'], name=u'email_mailing_list_email_id_fkey'),
    sa.ForeignKeyConstraint(['mailing_list_id'], [u'mailing_list.id'], name=u'email_mailing_list_mailing_list_id_fkey')
    )
    # ### end Alembic commands ### 
Example 26
Project: Adventure-Insecure   Author: colinnewell   File: 7b0843b4944f_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('order_header',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.Column('date_modified', sa.DateTime(), nullable=True),
    sa.Column('title', sa.Text(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('order_line',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.Column('date_modified', sa.DateTime(), nullable=True),
    sa.Column('request', sa.Text(), nullable=False),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.Column('order_for', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['order_for'], ['users.id'], ),
    sa.ForeignKeyConstraint(['order_id'], ['order_header.id'], name='order_id_fkey'),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 27
Project: GenomicsSampleAPIs   Author: Intel-HLS   File: 183533b82112_fix_callset_dbarray_mapping_individual_.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    # Drop trigger
    op.execute(
        'DROP TRIGGER increment_num_rows_in_db_array ON callset_to_db_array_association CASCADE')
    op.drop_column(u'db_array', 'num_rows')
    op.create_table(
        'db_row',
        sa.Column('id', sa.BIGINT(), nullable=False),
        sa.Column('db_array_id', sa.BIGINT(), autoincrement=False, nullable=False),
        sa.Column('tile_row_id', sa.BIGINT(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(['db_array_id'],[u'db_array.id'], name=u'db_row_db_array_id_fkey'),
        sa.PrimaryKeyConstraint('id', name=u'db_row_pkey'))
    op.add_column(
        u'callset',
        sa.Column('individual_id', sa.BIGINT(), autoincrement=False, nullable=False))
    op.add_column(u'callset', sa.Column('dbrow_id', sa.BIGINT(), autoincrement=False, nullable=False))
    op.drop_constraint('callset_source_sample_id_fkey','callset', type_='foreignkey')
    op.drop_constraint('callset_target_sample_id_fkey','callset', type_='foreignkey')
    op.create_foreign_key(u'callset_individual_id_fkey','callset', 'individual', ['individual_id'], ['id'])
    op.create_foreign_key(u'callset_dbrow_id_fkey','callset', 'db_row', ['dbrow_id'], ['id'])
    op.drop_column(u'callset', 'target_sample_id')
    op.drop_column(u'callset', 'source_sample_id')
    op.drop_index('db_array_id_tile_row_id_idx',table_name='callset_to_db_array_association')
    op.drop_table('callset_to_db_array_association')
    op.drop_table('sample') 
Example 28
Project: quark   Author: openstack   File: 26e984b48a0d_revise_security_group_rules.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # NOTE(mdietz): You can't change the datatype or remove columns,
    #               in SQLite, please see
    #               http://sqlite.org/lang_altertable.html
    op.drop_table(OLD_TABLE)
    op.create_table(
        NEW_TABLE,
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('group_id', sa.String(length=36), nullable=False),
        sa.Column('direction', sa.String(length=10), nullable=False),
        sa.Column('port_range_max', sa.Integer(), nullable=True),
        sa.Column('port_range_min', sa.Integer(), nullable=True),
        sa.Column('protocol', sa.Integer(), nullable=True),
        sa.Column("ethertype", type_=sa.Integer(), nullable=False),
        sa.Column('remote_group_id', sa.String(length=36), nullable=True),
        sa.Column("remote_ip_prefix", type_=sa.String(255)),
        sa.ForeignKeyConstraint(["remote_group_id"],
                                ["quark_security_groups.id"],
                                "fk_remote_group_id"),
        sa.ForeignKeyConstraint(['group_id'], ['quark_security_groups.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine="InnoDB") 
Example 29
Project: CTPU   Author: SimmyD   File: a805aa0c410b_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('event',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=120), nullable=True),
    sa.Column('description', sa.String(length=120), nullable=True),
    sa.Column('date', sa.Date(), nullable=True),
    sa.Column('location', sa.String(length=120), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('enrolments',
    sa.Column('event_id', sa.Integer(), nullable=False),
    sa.Column('person_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['event_id'], ['event.id'], ),
    sa.ForeignKeyConstraint(['person_id'], ['person.id'], ),
    sa.PrimaryKeyConstraint('event_id', 'person_id')
    )
    # ### end Alembic commands ### 
Example 30
Project: fabric8-analytics-server   Author: fabric8-analytics   File: e48c7b4235aa_drop_analysisrequest_table.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    """Downgrade the database to an older revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.drop_column('batches_versions', 'id')
    op.create_table('analysis_requests',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('job_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
                    sa.Column('submitted_at', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.Column('fulfilled_at', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.Column('analysis_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('parent_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['analysis_id'], ['analyses.id'],
                                            name='analysis_requests_analysis_id_fkey'),
                    sa.ForeignKeyConstraint(['version_id'], ['versions.id'],
                                            name='analysis_requests_version_id_fkey'),
                    sa.PrimaryKeyConstraint('id', name='analysis_requests_pkey'))
    # end Alembic commands ### 
Example 31
Project: fabric8-analytics-server   Author: fabric8-analytics   File: ea55c632ae8d_create_auth_data.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    """Upgrade the database to a newer revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.create_table('role',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=True),
                    sa.Column('description', sa.String(length=255), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name'))
    op.create_table('user',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('login', sa.String(length=255), nullable=True),
                    sa.Column('email', sa.String(length=255), nullable=True),
                    sa.Column('password', sa.String(length=255), nullable=True),
                    sa.Column('active', sa.Boolean(), nullable=True),
                    sa.Column('token', sa.String(length=255), nullable=True),
                    sa.Column('token_expires', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('login'))
    op.create_table('roles_users',
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('role_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
                    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ))
    # end Alembic commands ### 
Example 32
Project: fabric8-analytics-server   Author: fabric8-analytics   File: a0433904c63b_analysis_requests.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    """Upgrade the database to a newer revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.create_table('analysis_requests',
                    sa.Column('ecosystem', sa.Integer(), nullable=True),
                    sa.Column('package', sa.String(length=255), nullable=True),
                    sa.Column('version', sa.String(length=255), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('job_id', sa.String(length=255), nullable=True),
                    sa.Column('submitted_at', sa.DateTime(), nullable=True),
                    sa.Column('fulfilled_at', sa.DateTime(), nullable=True),
                    sa.Column('analysis_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(['analysis_id'], ['analyses.id'], ),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index('epv_index', 'analysis_requests', ['ecosystem', 'package', 'version'],
                    unique=True, postgresql_where=sa.text('fulfilled_at IS NULL'))
    # end Alembic commands ### 
Example 33
Project: fabric8-analytics-server   Author: fabric8-analytics   File: 6e7ff4c3177e_remove_batches.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    """Downgrade the database to an older revision."""
    # # commands auto generated by Alembic - please adjust! ###
    op.create_table('batches_versions',
                    sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('batch_token', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
                    sa.ForeignKeyConstraint(['batch_token'], ['batch.token'],
                                            name='batches_versions_batch_token_fkey'),
                    sa.ForeignKeyConstraint(['version_id'], ['versions.id'],
                                            name='batches_versions_version_id_fkey'))
    op.create_table('batch',
                    sa.Column('token', sa.INTEGER(), nullable=False),
                    sa.Column('started_at', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('token', name='batch_pkey'))
    # # end Alembic commands ### 
Example 34
Project: knowledge-repo   Author: airbnb   File: 36baffc5df12_add_groups_permissions_to_posts.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('groups',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('assoc_group_user',
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], )
    )
    op.create_table('assoc_post_group',
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], )
    )
    op.add_column(u'posts', sa.Column('private', sa.Integer(), nullable=True)) 
Example 35
Project: automated-survey-flask   Author: TwilioDevEd   File: 5a7f7ef390ce_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('surveys',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('questions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.String(), nullable=False),
    sa.Column('kind', sa.Enum('text', 'numeric', 'boolean', name='question_kind'), nullable=True),
    sa.Column('survey_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['survey_id'], ['surveys.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('answers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.String(), nullable=False),
    sa.Column('session_id', sa.String(), nullable=False),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 36
Project: zeus   Author: getsentry   File: f810bb64d19b_email.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('email',
                    sa.Column('user_id', zeus.db.types.guid.GUID(),
                              nullable=False),
                    sa.Column('email', sa.String(length=128), nullable=False),
                    sa.Column('verified', sa.Boolean(), nullable=True),
                    sa.Column('id', zeus.db.types.guid.GUID(), nullable=False),
                    sa.Column('date_created', sa.TIMESTAMP(timezone=True),
                              server_default=sa.text('now()'), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['user_id'], ['user.id'], ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('user_id', 'email',
                                        name='unq_user_email')
                    )
    op.create_index(op.f('ix_email_user_id'), 'email',
                    ['user_id'], unique=False)
    # ### end Alembic commands ### 
Example 37
Project: zeus   Author: getsentry   File: 9227d42a8935_failure_reasons.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'failurereason',
        sa.Column('job_id', zeus.db.types.guid.GUID(), nullable=False),
        sa.Column('reason', zeus.db.types.enum.StrEnum(), nullable=False),
        sa.Column('repository_id', zeus.db.types.guid.GUID(), nullable=False),
        sa.Column('id', zeus.db.types.guid.GUID(), nullable=False),
        sa.Column(
            'date_created',
            sa.TIMESTAMP(timezone=True),
            server_default=sa.text('now()'),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('job_id', 'reason', name='unq_failurereason_key')
    )
    op.create_index(
        op.f('ix_failurereason_repository_id'), 'failurereason', ['repository_id'], unique=False
    )
    # ### end Alembic commands ### 
Example 38
Project: database_project   Author: HughWen   File: 38c4e85512a9_initial_migration.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_users_username', 'users', ['username'], unique=True)
    ### end Alembic commands ### 
Example 39
Project: metaseek   Author: ahoarfrost   File: aa1ce7a80455_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('publication',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pubmed_uid', sa.String(length=30), nullable=True),
    sa.Column('pubmed_link', sa.Text(), nullable=True),
    sa.Column('pub_publication_date', sa.DateTime(), nullable=True),
    sa.Column('pub_authors', sa.Text(), nullable=True),
    sa.Column('pub_title', sa.Text(), nullable=True),
    sa.Column('pub_volume', sa.String(length=20), nullable=True),
    sa.Column('pub_issue', sa.String(length=20), nullable=True),
    sa.Column('pub_pages', sa.String(length=30), nullable=True),
    sa.Column('pub_journal', sa.Text(), nullable=True),
    sa.Column('pub_doi', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('dataset_to_publication',
    sa.Column('dataset_id', sa.Integer(), nullable=True),
    sa.Column('publication_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['dataset_id'], ['dataset.id'], ),
    sa.ForeignKeyConstraint(['publication_id'], ['publication.id'], )
    )
    # ### end Alembic commands ### 
Example 40
Project: metaseek   Author: ahoarfrost   File: 01b5eeb0b2bf_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('run',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('run_id', sa.String(length=30), nullable=True),
    sa.Column('library_reads_sequenced', sa.BIGINT(), nullable=True),
    sa.Column('total_num_bases', sa.BIGINT(), nullable=True),
    sa.Column('download_size', sa.BIGINT(), nullable=True),
    sa.Column('avg_read_length', sa.Float(), nullable=True),
    sa.Column('baseA_count', sa.BIGINT(), nullable=True),
    sa.Column('baseC_count', sa.BIGINT(), nullable=True),
    sa.Column('baseG_count', sa.BIGINT(), nullable=True),
    sa.Column('baseT_count', sa.BIGINT(), nullable=True),
    sa.Column('baseN_count', sa.BIGINT(), nullable=True),
    sa.Column('gc_percent', sa.Float(), nullable=True),
    sa.Column('run_quality_counts', sa.Text(), nullable=True),
    sa.Column('dataset_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['dataset_id'], ['dataset.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_unique_constraint(None, 'dataset', ['db_source_uid'])
    # ### end Alembic commands ### 
Example 41
Project: cci-demo-flask   Author: circleci   File: ffe4c66b5772_add_shared_notes.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('shared_notes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.Column('updated_date', sa.DateTime(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('note_id', sa.Integer(), nullable=True),
    sa.Column('recipient_email', sa.String(length=254), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['note_id'], ['notes.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_shared_notes_created_date'), 'shared_notes', ['created_date'], unique=False)
    op.create_index(op.f('ix_shared_notes_updated_date'), 'shared_notes', ['updated_date'], unique=False)
    op.add_column('users', sa.Column('last_login_date', sa.DateTime(), nullable=True))
    ### end Alembic commands ### 
Example 42
Project: hug-n-rest   Author: khanhicetea   File: 0fac3c350508_new_update.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('groups',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=True),
    sa.Column('alias', sa.String(length=100), nullable=True),
    sa.Column('max_members', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=True),
    sa.Column('fullname', sa.String(length=100), nullable=True),
    sa.Column('email', sa.String(length=50), nullable=True),
    sa.Column('password', sa.String(length=64), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 43
Project: project   Author: Junctionzc   File: 1080b8a7b02c_add_comment.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_comments_timestamp'), 'comments', ['timestamp'], unique=False)
    ### end Alembic commands ### 
Example 44
Project: hreftoday   Author: soasme   File: 81a76b1112b2_remove_issue.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('issue',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('serial', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('published_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('title', sa.VARCHAR(length=128), server_default=sa.text(u"''::character varying"), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_issue_topic'),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_issue_user'),
    sa.PrimaryKeyConstraint('id', name=u'issue_pkey'),
    sa.UniqueConstraint('topic_id', 'serial', name=u'ux_issue_topic_serial')
    )
    op.add_column('link', sa.Column('issue_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint('fk_link_topic', 'link', type_='foreignkey')
    op.create_foreign_key(u'fk_link_issue', 'link', 'issue', ['issue_id'], ['id'])
    op.create_index('ix_issue', 'link', ['issue_id'], unique=False)
    op.drop_column('link', 'topic_id')
    ### end Alembic commands ### 
Example 45
Project: ddots-api-server   Author: frol   File: bc763380bd74_add_solutions_module.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('solution',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('problem_id', sa.Integer(), nullable=False),
        sa.Column('programming_language_name', sa.String(length=20), nullable=False),
        sa.Column('testing_mode', sa.Enum('one', 'first_fail', 'full', name='testingmodes'), nullable=False),
        sa.Column('state', sa.Enum('new', 'reserved', 'received', 'tested', 'rejected', name='states'), nullable=False),
        sa.Column('status', sqlalchemy_utils.types.scalar_list.ScalarListType(), nullable=False),
        sa.Column('scored_points', sa.Numeric(precision=3), nullable=False),
        sa.Column('source_code_seaweed_id', sa.String(length=255), nullable=False),
        sa.Column('testing_report_seaweed_id', sa.String(length=255), nullable=False),
        sa.Column('creator_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['creator_id'], ['user.id'], ),
        sa.ForeignKeyConstraint(['problem_id'], ['problem.id'], ),
        sa.ForeignKeyConstraint(['programming_language_name'], ['programming_language.name'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
Example 46
Project: contactista   Author: singingwolfboy   File: 8e660f5e482c_tag_model.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tag',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('color', ColorType(length=20), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'name')
    )
    op.create_table('contact_tag',
    sa.Column('contact_id', sa.Integer(), nullable=False),
    sa.Column('tag_id', sa.Integer(), nullable=False),
    sa.Column('position', sa.Integer(), nullable=False),
    sa.Column('note', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['contact_id'], ['contact.id'], ),
    sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
    sa.PrimaryKeyConstraint('contact_id', 'tag_id')
    )
    # ### end Alembic commands ###
    op.execute(CreateSequence(Sequence('contact_tag_position'))) 
Example 47
Project: TypingSystem   Author: TrustMe5   File: fee089fdee78_.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('name', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8_unicode_ci',
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('users',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('username', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.Column('role_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('email', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.Column('password_hash', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128), nullable=True),
    sa.Column('confirmed', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['role_id'], [u'roles.id'], name=u'users_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8_unicode_ci',
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_table('context_show')
    ### end Alembic commands ### 
Example 48
Project: TypingSystem   Author: TrustMe5   File: 38c4e85512a9_initial_migration.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_users_username', 'users', ['username'], unique=True)
    ### end Alembic commands ### 
Example 49
Project: m2m   Author: neo1218   File: fcf1a45d636_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('default', sa.Boolean(), nullable=True),
    sa.Column('permissions', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=164), nullable=True),
    sa.Column('email', sa.String(length=164), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.Column('password_hash', sa.String(length=164), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    ### end Alembic commands ### 
Example 50
Project: m2m   Author: neo1218   File: 36c3e9686e09_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('teachers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=164), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('teachusers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('student_id', sa.Integer(), nullable=True),
    sa.Column('teacher_id', sa.Integer(), nullable=True),
    sa.Column('count', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['student_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['teacher_id'], ['teachers.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###