Python alembic.op.create_table() Examples

The following are code examples for showing how to use alembic.op.create_table(). 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: FRG-Crowdsourcing   Author: 97amarnathk   File: d1add5e3e65e_projects_stats.py    (GNU Affero General Public License v3.0) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'project_stats',
        sa.Column('id', sa.Integer, primary_key=True),
        sa.Column('project_id', sa.Integer, sa.ForeignKey('project.id',
                                                          ondelete='CASCADE')),
        sa.Column('n_tasks', sa.Integer, default=0),
        sa.Column('n_task_runs', sa.Integer, default=0),
        sa.Column('n_results', sa.Integer, default=0),
        sa.Column('n_volunteers', sa.Integer, default=0),
        sa.Column('n_completed_tasks', sa.Integer, default=0),
        sa.Column('overall_progress', sa.Integer, default=0),
        sa.Column('average_time', sa.Float, default=0),
        sa.Column('n_blogposts', sa.Integer, default=0),
        sa.Column('last_activity', sa.Text, default=make_timestamp),
        sa.Column('info', JSON, nullable=False)
    ) 
Example 2
Project: cyborg   Author: openstack   File: f50980397351_initial_migration.py    (Apache License 2.0) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'accelerators',
        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('uuid', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=False),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column('project_id', sa.String(length=36), nullable=True),
        sa.Column('user_id', sa.String(length=36), nullable=True),
        sa.Column('device_type', sa.Text(), nullable=False),
        sa.Column('acc_type', sa.Text(), nullable=False),
        sa.Column('acc_capability', sa.Text(), nullable=False),
        sa.Column('vendor_id', sa.Text(), nullable=False),
        sa.Column('product_id', sa.Text(), nullable=False),
        sa.Column('remotable', sa.Integer(), nullable=False),
        sa.PrimaryKeyConstraint('id'),
        mysql_ENGINE='InnoDB',
        mysql_DEFAULT_CHARSET='UTF8'
    ) 
Example 3
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 4
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 5
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 6
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 7
Project: 1ibrary-gzhu   Author: 1ibrary   File: 525c4fa30db4_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('hot_books',
    sa.Column('book_id', sa.Integer(), nullable=False),
    sa.Column('book_author', sa.Text(), nullable=True),
    sa.Column('book_cover', sa.Text(), nullable=True),
    sa.Column('book_rate', sa.Integer(), nullable=True),
    sa.Column('book_content', sa.Text(), nullable=True),
    sa.Column('book_publish', sa.Text(), nullable=True),
    sa.Column('book_last_number', sa.Integer(), nullable=True),
    sa.Column('book_key', sa.String(length=13), nullable=True),
    sa.Column('book_db_id', sa.Integer(), nullable=True),
    sa.Column('book_title', sa.Text(), nullable=True),
    sa.Column('book_place', sa.Text(), nullable=True),
    sa.Column('detail_data', sa.Text(), nullable=True),
    sa.Column('hot_id', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('book_id'),
    sa.UniqueConstraint('book_db_id')
    )
    op.create_index(op.f('ix_hot_books_book_key'), 'hot_books', ['book_key'], unique=False)
    # ### end Alembic commands ### 
Example 8
Project: zun   Author: openstack   File: 10d65e285a59_create_volume_mapping_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'volume_mapping',
        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('uuid', sa.String(36), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('volume_id', sa.String(36), nullable=False),
        sa.Column('volume_provider', sa.String(36), nullable=False),
        sa.Column('container_uuid', sa.String(36), nullable=False),
        sa.Column('container_path', sa.String(length=255), nullable=True),
        sa.Column('connection_info', MediumText(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_volume0uuid'),
    ) 
Example 9
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 10
Project: zun   Author: openstack   File: 9fe371393a24_create_table_container.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'container',
        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('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('uuid', sa.String(length=36), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('image', sa.String(length=255), nullable=True),
        sa.Column('command', sa.String(length=255), nullable=True),
        sa.Column('status', sa.String(length=20), nullable=True),
        sa.Column('environment', zun.db.sqlalchemy.models.JSONEncodedDict(),
                  nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_container0uuid')
    ) 
Example 11
Project: zun   Author: openstack   File: 72c6947c6636_create_table_image.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # commands auto generated by Alembic - please adjust! #
    op.create_table(
        'image',
        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('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('uuid', sa.String(length=36), nullable=True),
        sa.Column('image_id', sa.String(length=255), nullable=True),
        sa.Column('repo', sa.String(length=255), nullable=True),
        sa.Column('tag', sa.String(length=255), nullable=True),
        sa.Column('size', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('repo', 'tag', name='uniq_image0repotag'),
        mysql_charset='utf8',
        mysql_engine='InnoDB'
        )
    #  end Alembic commands # 
Example 12
Project: zun   Author: openstack   File: a251f1f61217_create_capsule_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'capsule',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('capsule_version', sa.String(length=255), nullable=True),
        sa.Column('kind', sa.String(length=36), nullable=True),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('restart_policy', sa.String(length=255), nullable=True),
        sa.Column('host_selector', sa.String(length=255), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('uuid', sa.String(length=36), nullable=False),
        sa.Column('status', sa.String(length=255), nullable=True),
        sa.Column('status_reason', sa.Text(), nullable=True),
        sa.Column('message', models.JSONEncodedDict(), nullable=True),
        sa.Column('spec', models.JSONEncodedDict(), nullable=True),
        sa.Column('cpu', sa.Float(), nullable=True),
        sa.Column('memory', sa.String(length=255), nullable=True),
        sa.Column('meta_name', sa.String(length=255), nullable=True),
        sa.Column('meta_labels', models.JSONEncodedList(), nullable=True),
        sa.Column('containers_uuids', models.JSONEncodedList(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
    ) 
Example 13
Project: zun   Author: openstack   File: a9a92eebd9a8_create_table_zun_service.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'zun_service',
        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('report_count', sa.Integer(), nullable=False),
        sa.Column('host', sa.String(length=255), nullable=True),
        sa.Column('binary', sa.String(length=255), nullable=True),
        sa.Column('disabled', sa.Boolean(), nullable=True),
        sa.Column('disabled_reason', sa.String(length=255), nullable=True),
        sa.Column('last_seen_up', sa.DateTime(), nullable=True),
        sa.Column('forced_down', sa.Boolean(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('host', 'binary',
                            name='uniq_zun_service0host0binary')
    ) 
Example 14
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 15
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 16
Project: picasso   Author: openstack   File: 7a2dcf8ac8bf_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'apps',
        sa.Column('id', sa.String(255), nullable=False),
        sa.Column('project_id', sa.String(255), nullable=False),
        sa.Column('description', sa.String(255), nullable=True),
        sa.Column('created_at', sa.String(255)),
        sa.Column('updated_at', sa.String(255)),
        sa.Column('name', sa.String(255), nullable=False, primary_key=True),
    )
    op.create_table(
        'routes',
        sa.Column('project_id', sa.String(255), nullable=False),
        sa.Column('path', sa.String(255), nullable=False, primary_key=True),
        sa.Column('is_public', sa.Boolean(create_constraint=False), nullable=False),
        sa.Column('app_name', sa.String(255), nullable=False, primary_key=True),
        sa.Column('created_at', sa.String(255), nullable=False),
        sa.Column('updated_at', sa.String(255), nullable=False),
    ) 
Example 17
Project: retrospective-bot   Author: bayesimpact   File: 574083c098fc_create_retrospective_items_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('sprints',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_name', sa.Unicode(), nullable=True),
        sa.Column('creation_date', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id'))

    op.create_table('retrospective_items',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('sprint_id', sa.Integer(), nullable=False),
        sa.Column('category', sa.Unicode(), nullable=True),
        sa.Column('text', sa.Unicode(), nullable=True),
        sa.Column('user_name', sa.Unicode(), nullable=True),
        sa.Column('creation_date', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_retrospective_items'), 'retrospective_items', ['sprint_id', 'category'], unique=False) 
Example 18
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 19
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 20
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 21
Project: forget   Author: codl   File: f8a153bc809b_add_mastodon_instances.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table('mastodon_instances',
    sa.Column('instance', sa.String(), nullable=False),
    sa.Column('popularity', sa.Float(), server_default='10', nullable=False),
    sa.PrimaryKeyConstraint('instance', name=op.f('pk_mastodon_instances'))
    )
    op.execute("""
        INSERT INTO mastodon_instances (instance, popularity) VALUES
            ('mastodon.social', 100),
            ('mastodon.cloud', 90),
            ('social.tchncs.de', 80),
            ('mastodon.xyz', 70),
            ('mstdn.io', 60),
            ('awoo.space', 50),
            ('cybre.space', 40),
            ('mastodon.art', 30)
            ;
    """) 
Example 22
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 23
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 24
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 25
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 26
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 27
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 28
Project: conditional   Author: ComputerScienceHouse   File: 983d69afb7f8_.py    (license) View Source Project 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('housing_evals',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('uid', sa.VARCHAR(length=32), nullable=False),
    sa.Column('social_attended', sa.TEXT(), nullable=False),
    sa.Column('social_hosted', sa.TEXT(), nullable=False),
    sa.Column('technical_attended', sa.TEXT(), nullable=False),
    sa.Column('technical_hosted', sa.TEXT(), nullable=False),
    sa.Column('projects', sa.TEXT(), nullable=False),
    sa.Column('comments', sa.TEXT(), nullable=False),
    sa.Column('points', sa.INTEGER(), nullable=False),
    sa.Column('active', sa.BOOLEAN(), nullable=False),
    sa.Column('date_created', sa.DATE(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
Example 29
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 30
Project: coverage2sql   Author: openstack   File: 52dfb338f74e_add_coverages_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    migration_context = context.get_context()
    if migration_context.dialect.name == 'sqlite':
        id_type = sa.Integer
    else:
        id_type = sa.BigInteger

    op.create_table('coverages',
                    sa.Column('id', id_type, autoincrement=True,
                              primary_key=True),
                    sa.Column('project_name', sa.String(256), nullable=False),
                    sa.Column('coverage_rate', sa.Float()),
                    sa.Column('report_time', sa.DateTime()),
                    sa.Column('report_time_microsecond', sa.Integer(),
                              default=0),
                    mysql_engine='InnoDB')
    op.create_index('ix_project_name', 'coverages', ['project_name']) 
Example 31
Project: coverage2sql   Author: openstack   File: 79dead6f7c26_add_files_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    migration_context = context.get_context()
    if migration_context.dialect.name == 'sqlite':
        id_type = sa.Integer
    else:
        id_type = sa.BigInteger

    op.create_table('files',
                    sa.Column('id', id_type, autoincrement=True,
                              primary_key=True),
                    sa.Column('coverage_id', id_type, nullable=False),
                    sa.Column('filename', sa.String(256), nullable=False),
                    sa.Column('line_rate', sa.Float()),
                    mysql_engine='InnoDB')
    op.create_index('ix_class_coverage_id', 'files', ['coverage_id'])
    op.create_index('ix_filename', 'files', ['filename']) 
Example 32
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 33
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 34
Project: chihu   Author: yelongyu   File: 8d684695a2ec_add_statistic_visitor_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('statistic_visitor',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('last_count', sa.DateTime(), nullable=True),
    sa.Column('referred', sa.String(length=128), nullable=False),
    sa.Column('agent', sa.String(length=64), nullable=True),
    sa.Column('platform', sa.String(length=64), nullable=True),
    sa.Column('version', sa.String(length=64), nullable=True),
    sa.Column('ip', sa.String(length=64), nullable=True),
    sa.Column('hits', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id', 'referred'),
    sa.UniqueConstraint('id'),
    sa.UniqueConstraint('referred')
    )
    op.create_index(op.f('ix_statistic_visitor_last_count'), 'statistic_visitor', ['last_count'], unique=False)
    ### end Alembic commands ### 
Example 35
Project: ShelbySearch   Author: Agentscreech   File: cdd79c0c05f6_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('search_results',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('url', sa.String(), nullable=True),
    sa.Column('vin', sa.String(), nullable=True),
    sa.Column('dealer', sa.String(), nullable=True),
    sa.Column('distance', sa.String(), nullable=True),
    sa.Column('listing', sa.String(), nullable=True),
    sa.Column('address', sa.String(), nullable=True),
    sa.Column('phone', sa.String(), nullable=True),
    sa.Column('price', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_column('cars', 'painted_roof')
    # ### end Alembic commands ### 
Example 36
Project: ShelbySearch   Author: Agentscreech   File: ac55f42f620f_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cars',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('vin', sa.String(), nullable=True),
    sa.Column('year', sa.Integer(), nullable=True),
    sa.Column('r_model', sa.Boolean(), nullable=True),
    sa.Column('color', sa.String(), nullable=True),
    sa.Column('stripe', sa.String(), nullable=True),
    sa.Column('electronics', sa.Boolean(), nullable=True),
    sa.Column('convenience', sa.Boolean(), nullable=True),
    sa.Column('painted_roof', sa.Boolean(), nullable=True),
    sa.Column('build_date', sa.String(), nullable=True),
    sa.Column('price', sa.String(), nullable=True),
    sa.Column('dealer', sa.String(), nullable=True),
    sa.Column('address', sa.String(), nullable=True),
    sa.Column('phone', sa.String(), nullable=True),
    sa.Column('url', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ### 
Example 37
Project: aiorchestra-persistence   Author: aiorchestra   File: f1a1565a8dd4_aiorchestra_persistency.py    (license) View Source Project 6 votes vote down vote up
def upgrade():

    op.create_table(
        'context',
        sa.Column('name', sa.String(), nullable=False, unique=True, primary_key=True),
        sa.Column('status', sa.String(), nullable=False),
        sa.Column('template_path', sa.String(), nullable=False),
        sa.Column('inputs', sa.Text(), nullable=False),
    )
    op.create_table(
        'node',
        sa.Column('context', sa.String(), sa.ForeignKey('context.name'), ),
        sa.Column('name', sa.String(), nullable=False, unique=True),
        sa.Column('is_provisioned', sa.Boolean(), nullable=False),
        sa.Column('properties', sa.Text(), nullable=True),
        sa.Column('attributes', sa.Text(), nullable=True),
        sa.Column('runtime_properties', sa.Text(), nullable=True),
    ) 
Example 38
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 39
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 40
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 41
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 42
Project: Adventure-Insecure   Author: colinnewell   File: 24bb227a82fa_.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    t = op.create_table('office_numbers',
    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('name', sa.String(length=128), nullable=False),
    sa.Column('number_prefix', sa.String(length=128), nullable=False),
    sa.Column('main_number', sa.String(length=128), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.bulk_insert(t, [
        {
            'name': 'Main Office',
            'number_prefix': '555-1',
            'main_number': '555-13211-3221',
        },
        {
            'name': 'Babel Office',
            'number_prefix': '555-2',
            'main_number': '555-21111-3221',
        },
        {
            'name': 'Office Minnows',
            'number_prefix': '555-9',
            'main_number': '555-99911-3221',
        },
    ])
    ### end Alembic commands ### 
Example 43
Project: picmeup   Author: zhonghcc   File: 144639404d09_02_create_collection.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'collections',
        sa.Column('id',sa.Integer,primary_key=True,autoincrement=True),
        sa.Column('name',sa.String(255), nullable=False,unique=True),

        sa.Column('created_time',sa.DateTime, default=datetime.now),
        sa.Column('updated_time',sa.DateTime, default=datetime.now),

        sa.Column('author_id',sa.Integer,nullable=True),
        sa.Column('status',sa.Integer, nullable=False),
        sa.Column('order',sa.Integer,nullable=True,default=0)
    )
    op.create_table(
        'collection_items',
        sa.Column('id',sa.Integer,primary_key=True,autoincrement=True),
        sa.Column('collection_id',sa.Integer,nullable=True),
        sa.Column('article_id',sa.Integer,nullable=True),

        sa.Column('created_time',sa.DateTime, default=datetime.now),
        sa.Column('updated_time',sa.DateTime, default=datetime.now),

        sa.Column('status',sa.Integer, nullable=False),
        sa.Column('order',sa.Integer,nullable=True,default=0)
    ) 
Example 44
Project: picmeup   Author: zhonghcc   File: b5b843df7bcb_05_tag_and_collection.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.drop_column('tags','author_id')
    op.add_column('tags',sa.Column('user_id',sa.Integer,nullable=True,default=0))
    op.add_column('users',sa.Column('coin_num',sa.Integer,nullable=False,default=5))
    op.create_table(
            'coins',
            sa.Column('id',sa.Integer,primary_key=True,autoincrement=True),
            sa.Column('direction',sa.String(50),nullable=False,default=""),
            sa.Column('reason',sa.String(50),nullable=False,default=""),
            sa.Column('article_id',sa.Integer, nullable=True),
            sa.Column('user_id',sa.Integer, nullable=True),
            sa.Column('ip',sa.String(50), nullable=True),
            sa.Column('coin_num',sa.Integer, nullable=False,default=0),

            sa.Column('created_time',sa.DateTime, default=datetime.now),
            sa.Column('updated_time',sa.DateTime, default=datetime.now),

            sa.Column('status',sa.Integer, nullable=False),
    )
    pass 
Example 45
Project: GenomicsSampleAPIs   Author: Intel-HLS   File: 3c9c82e8dc86_create_reference_table.py    (license) View Source Project 6 votes vote down vote up
def upgrade():
    op.create_table(
        'reference',
        sa.Column('id', sa.BigInteger, primary_key=True),
        sa.Column('guid', sa.String(36), nullable=False, unique=True),
        sa.Column('length', sa.BigInteger),
        sa.Column('reference_set_id', sa.BigInteger,
                  sa.ForeignKey('reference_set.id'), nullable=False),
        sa.Column('md5_checksum', sa.String(32)),
        sa.Column('name', sa.Text),
        sa.Column('source_uri', sa.Text),
        sa.Column('is_derived', sa.Boolean),
        sa.Column('source_divergence', sa.Float),
        sa.Column('ncbi_taxon_id', sa.Integer),
        sa.Column('offset', sa.BigInteger)
    ) 
Example 46
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 47
Project: fuel-nailgun-extension-iac   Author: openstack   File: e3b840e64e53_init.py    (Apache License 2.0) View Source Project 5 votes vote down vote up
def upgrade():
    table_prefix = context.config.get_main_option('table_prefix')
    op.create_table(
        table_prefix + 'repos',
        sa.Column('id', sa.Integer(), nullable=False, primary_key=True),
        sa.Column('repo_name', sa.Unicode(100), nullable=False),
        sa.Column('env_id', sa.Integer(), nullable=False),
        sa.Column('git_url', sa.String(255),
                  server_default='', nullable=False),
        sa.Column('ref', sa.String(255),
                  server_default='', nullable=False),
        sa.Column('user_key', sa.String(255),
                  server_default='', nullable=False),
        sa.UniqueConstraint('env_id', name='_env_id_unique')) 
Example 48
Project: fuel-nailgun-extension-iac   Author: openstack   File: 8736ad38ca31_add_whitelist_table.py    (Apache License 2.0) View Source Project 5 votes vote down vote up
def upgrade():
    table_prefix = context.config.get_main_option('table_prefix')
    op.create_table(
        table_prefix + 'changes_whitelist',
        sa.Column('id', sa.Integer(), nullable=False, primary_key=True),
        sa.Column('env_id', sa.Integer(), nullable=False),
        sa.Column('rule', sa.String(255),
                  server_default='', nullable=False)
    ) 
Example 49
Project: zlktqa   Author: NunchakusHuang   File: a524f97f269b_.py    (license) View Source Project 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.String(length=100), nullable=False),
    sa.Column('username', sa.String(length=100), nullable=False),
    sa.Column('telephone', sa.String(length=11), nullable=False),
    sa.Column('_password', sa.String(length=100), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('questions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=100), nullable=False),
    sa.Column('content', sa.Text(), nullable=False),
    sa.Column('author_id', sa.String(length=100), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('answers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.Text(), nullable=False),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.String(length=100), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ### 
Example 50
Project: BookCloud   Author: livro-aberto   File: 280d0531befe_create_user_subscription_to_thread_tags.py    (GNU General Public License v3.0) View Source Project 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_subscription',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('named_tag', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['named_tag'], ['named_tag.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    # ### end Alembic commands ###