我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用alembic.op.create_table()。
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) )
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' )
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 ###
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 ###
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 ###
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 ###
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 ###
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'), )
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') )
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') )
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 #
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'), )
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') )
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 ###
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), )
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)
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 ###
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 ###
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 ###
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) ; """)
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'))
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 ###
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') )
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 ###
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 ###
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 ###
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 ###
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 ###
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'])
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'])
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 ###
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 ###
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 ###
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 ###
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 ###
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), )
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 ###
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') )
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 ###
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 ###
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) )
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
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) )
def upgrade(): op.create_table('quark_locks', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('type', sa.Enum('ip_address'), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_engine='InnoDB') op.create_table('quark_lock_holders', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('lock_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint(['lock_id'], ['quark_locks.id'], ), sa.PrimaryKeyConstraint('id'), mysql_engine='InnoDB') op.add_column(u'quark_ip_addresses', sa.Column('lock_id', sa.Integer(), nullable=True))
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")
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'))
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) )
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 ###
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 ###