我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用sqlalchemy.BOOLEAN。
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 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 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.add_column('app', sa.Column(field, sa.BOOLEAN, default=True)) query = 'UPDATE app SET %s = True;' % field op.execute(query)
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('role', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('role_id_seq'::regclass)"), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('description', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='role_pkey'), sa.UniqueConstraint('name', name='role_name_key'), postgresql_ignore_search_path=False ) op.create_table('user', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('user_id_seq'::regclass)"), nullable=False), sa.Column('email', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('active', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('confirmed_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('password', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='user_pkey'), sa.UniqueConstraint('email', name='user_email_key'), postgresql_ignore_search_path=False ) op.create_table('roles_users', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['role_id'], ['role.id'], name='roles_users_role_id_fkey'), sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='roles_users_user_id_fkey') ) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('upload', 'hidden', existing_type=sa.BOOLEAN(), nullable=True, existing_server_default='false') op.add_column('user', sa.Column('tox_id', sa.String(length=72), nullable=True)) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('user', 'tox_id') op.alter_column('upload', 'hidden', existing_type=sa.BOOLEAN(), nullable=False, existing_server_default='false') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('pages', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('modified', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('modified_by_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('slug', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['created_by_id'], [u'users.id'], name=u'pages_created_by_id_fkey'), sa.ForeignKeyConstraint(['modified_by_id'], [u'users.id'], name=u'pages_modified_by_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'pages_pkey') ) op.add_column('menus_items', sa.Column('is_public', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('roles', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('page_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('is_group_label', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key(u'menus_items_page_id_fkey', 'menus_items', 'pages', ['page_id'], ['id']) op.create_foreign_key(u'menus_items_created_by_id_fkey', 'menus_items', 'users', ['created_by_id'], ['id']) op.add_column('menus', sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('menus', sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key(u'menus_created_by_id_fkey', 'menus', 'users', ['created_by_id'], ['id']) op.drop_table('menuitem_roles') ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('sentiments', sa.Column('is_negative', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_column('sentiments', 'score') # ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('current_coops', sa.Column('active', sa.BOOLEAN(), server_default=sa.sql.expression.true(), autoincrement=False, nullable=False)) op.drop_column('current_coops', 'semester') ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('cars', sa.Column('painted_roof', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_table('search_results') # ### end Alembic commands ###
def downgrade(): op.add_column('node', sa.Column('root_disk', sa.VARCHAR(length=80), autoincrement=False, nullable=False)) op.add_column('node', sa.Column('root_partition_size_sectors', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('wipe_root_disk_next_boot', sa.BOOLEAN(), autoincrement=False, nullable=False))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('cluster', sa.Column('allow_insecure_provision', sa.BOOLEAN(), autoincrement=False, nullable=False)) # ### end Alembic commands ###
def downgrade(): op.add_column("task", sa.Column("finished", sa.BOOLEAN(), autoincrement=False)) op.execute("update task set finished = true where status = 'finished'") op.execute("update task set finished = false where status in ('pending', 'processing')") op.execute("delete from task where status = 'deleted'") op.alter_column("task", "finished", nullable=False) op.drop_column("task", "status")
def downgrade(): """Downgrade the database to an older revision.""" # commands auto generated by Alembic - please adjust! ### op.create_table('review', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('user', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('comment', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('epv', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['user'], ['user.id'], name='review_user_fkey'), sa.PrimaryKeyConstraint('id', name='review_pkey')) # end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('email', 'verified', existing_type=sa.BOOLEAN(), nullable=False) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('email', 'verified', existing_type=sa.BOOLEAN(), nullable=True) # ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column(u'jobs', 'publication_datetime_is_fake', existing_type=sa.BOOLEAN(), nullable=True) op.drop_column(u'jobs', 'pushed_on_twitter') op.drop_column(u'jobs', 'longitude') op.drop_column(u'jobs', 'latitude') op.drop_column(u'jobs', 'last_sync') op.drop_column(u'jobs', 'last_modified') op.drop_column(u'jobs', 'geolocation_is_valid') op.drop_column(u'jobs', 'address_is_valid') op.drop_table('companies') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('topic', sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('topic_id_seq'::regclass)"), nullable=False), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=128), autoincrement=False, nullable=False), sa.Column('description', sa.TEXT(), autoincrement=False, nullable=False), sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('is_deleted', sa.BOOLEAN(), server_default=sa.text(u'false'), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_user'), sa.PrimaryKeyConstraint('id', name=u'topic_pkey'), postgresql_ignore_search_path=False ) op.create_table('topic_follow', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_topic_follow_topic'), sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_follow_user'), sa.PrimaryKeyConstraint('id', name=u'topic_follow_pkey'), sa.UniqueConstraint('topic_id', 'user_id', name=u'ux_topic_follow_user_follow_topic') ) op.add_column('link', sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key(u'fk_link_topic', 'link', 'topic', ['topic_id'], ['id']) ### end Alembic commands ###
def downgrade(): """Downgrade the database to an older revision.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('review', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('user', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('comment', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('epv', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['user'], ['user.id'], name='review_user_fkey'), sa.PrimaryKeyConstraint('id', name='review_pkey')) # ### end Alembic commands ###
def downgrade(): op.add_column('post', sa.Column('with_mod_name', sa.BOOLEAN(), autoincrement=False, nullable=False))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('email', sa.String(length=512), unique=True, nullable=True)) op.add_column('users', sa.Column('email_confirmed', sa.BOOLEAN(), nullable=False, server_default=sa.false())) op.add_column('users', sa.Column('register_time', sa.TIMESTAMP(), nullable=False, server_default=sa.func.now())) op.add_column('users', sa.Column('update_time', sa.TIMESTAMP(), nullable=False, server_default=sa.func.now())) ### end Alembic commands ###
def upgrade(pyramid_env): with context.begin_transaction(): # Is it me, or is virtuoso getting stupider? # It used to be possible to do the CHECK at the same time, like this: # op.add_column( # 'local_user_role', # sa.Column('requested', sa.BOOLEAN, server_default='0')) # Now doing it in two phases. op.add_column( 'local_user_role', sa.Column('requested', sa.SmallInteger, server_default='0')) op.execute('UPDATE local_user_role set requested = 0') op.execute('ALTER TABLE local_user_role ADD CHECK (requested IN (0, 1))')
def upgrade(pyramid_env): with context.begin_transaction(): # (I copied remarks from @maparent for reference) Is it me, or is virtuoso getting stupider? # It used to be possible to do the CHECK at the same time, like this: # op.add_column( # 'discussion', # sa.Column('subscribe_to_notifications_on_signup', sa.BOOLEAN, server_default='0')) # Now doing it in two phases. op.add_column( 'discussion', sa.Column('subscribe_to_notifications_on_signup', sa.SmallInteger, server_default='0')) op.execute('UPDATE discussion set subscribe_to_notifications_on_signup = 0') op.execute('ALTER TABLE discussion ADD CHECK (subscribe_to_notifications_on_signup IN (0, 1))')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('profile', sa.Column('profile_name', sa.String(length=128), nullable=False), sa.Column('properties', JSONB(), nullable=False), sa.PrimaryKeyConstraint('profile_name', name=op.f('profile_pkey')) ) op.create_table('configuration', sa.Column('key', sa.String(length=128), nullable=False), sa.Column('value', sa.String(length=1024), nullable=False), sa.PrimaryKeyConstraint('key', name=op.f('configuration_pkey')) ) op.create_table('device', sa.Column('device_id', sa.Integer(), nullable=False, autoincrement=True), sa.Column('device_type', sa.String(length=64), nullable=False), sa.Column('properties', JSONB(), nullable=True), sa.Column('hostname', sa.String(length=256), nullable=True), sa.Column('ip_address', sa.String(length=64), nullable=True), sa.Column('mac_address', sa.String(length=64), nullable=True), sa.Column('profile_name', sa.String(length=128), nullable=True), sa.Column('deleted', sa.BOOLEAN(), server_default=false_just_for_sqlalchemy(), nullable=False), sa.PrimaryKeyConstraint('device_id', name=op.f('device_pkey')), sa.ForeignKeyConstraint(['profile_name'], ['profile.profile_name'], name='device_profile', match='SIMPLE', ondelete='NO ACTION', onupdate='NO ACTION') ) op.create_table('log', sa.Column('process', sa.String(length=128), nullable=True), sa.Column('timestamp', sa.DateTime(timezone=True), nullable=False, server_default=func.now()), sa.Column('level', sa.Integer(), nullable=False), sa.Column('device_id', sa.Integer(), nullable=True), sa.Column('message', sa.Text(), nullable=False), sa.ForeignKeyConstraint(['device_id'], ['device.device_id'], name='log_process', match='SIMPLE', ondelete='NO ACTION', onupdate='NO ACTION'), sa.CheckConstraint('level = ANY (ARRAY[0, 10, 15, 20, 30, 40, 50])', name=op.f('valid_log_levels')) ) creating_functions() # ### end Alembic commands ###
def downgrade(): """Downgrade the database to an older revision.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('stacks', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('stacks_id_seq'::regclass)"), nullable=False), sa.Column('is_ref_stack', sa.BOOLEAN(), autoincrement=False, nullable=False), sa.Column('stack_json', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', name='stacks_pkey'), postgresql_ignore_search_path=False) op.create_table('similar_components', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('fromcomponent', sa.TEXT(), autoincrement=False, nullable=False), sa.Column('tocomponent', sa.TEXT(), autoincrement=False, nullable=False), sa.Column('similarity_distance', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', name='similar_components_pkey'), sa.UniqueConstraint('fromcomponent', 'tocomponent', name='sim_comps')) op.create_table('similar_stacks', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('analysis', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True), sa.Column('similar_stack_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('similarity_value', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=False), sa.Column('stack_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['similar_stack_id'], ['stacks.id'], name='similar_stacks_similar_stack_id_fkey'), sa.ForeignKeyConstraint(['stack_id'], ['stacks.id'], name='similar_stacks_stack_id_fkey'), sa.PrimaryKeyConstraint('id', name='similar_stacks_pkey'), sa.UniqueConstraint('stack_id', 'similar_stack_id', name='sim_unique')) op.create_table('esmarker', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('worker_result_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['worker_result_id'], ['worker_results.id'], name='esmarker_worker_result_id_fkey'), sa.PrimaryKeyConstraint('id', name='esmarker_pkey')) # ### end Alembic commands ###
def downgrade(): """Downgrade the database to an older revision.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('role', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('role_id_seq'::regclass)"), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('description', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='role_pkey'), sa.UniqueConstraint('name', name='role_name_key'), postgresql_ignore_search_path=False) op.create_table('user', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('user_id_seq'::regclass)"), nullable=False), sa.Column('login', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('email', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('password', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('active', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('token', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('token_expires', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='user_pkey'), sa.UniqueConstraint('login', name='user_login_key'), postgresql_ignore_search_path=False) op.create_table('permissions_roles', sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('permission_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['permission_id'], ['permission.id'], name='permissions_roles_permission_id_fkey'), sa.ForeignKeyConstraint(['role_id'], ['role.id'], name='permissions_roles_role_id_fkey')) op.create_table('roles_users', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['role_id'], ['role.id'], name='roles_users_role_id_fkey'), sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='roles_users_user_id_fkey')) op.create_table('permission', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='permission_pkey'), sa.UniqueConstraint('name', name='permission_name_key')) # ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('publisher', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('name', sa.TEXT(), nullable=False), sa.Column('title', sa.Text(), nullable=True), sa.Column('private', sa.BOOLEAN(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_publisher_name'), 'publisher', ['name'], unique=True) op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('email', sa.TEXT(), nullable=True), sa.Column('secret', sa.TEXT(), nullable=True), sa.Column('name', sa.TEXT(), nullable=False), sa.Column('full_name', sa.TEXT(), nullable=True), sa.Column('auth0_id', sa.TEXT(), nullable=True), sa.Column('sysadmin', sa.BOOLEAN(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_user_auth0_id'), 'user', ['auth0_id'], unique=False) op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=False) op.create_index(op.f('ix_user_name'), 'user', ['name'], unique=True) op.create_table('package', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('name', sa.TEXT(), nullable=True), sa.Column('descriptor', sa.JSON(), nullable=True), sa.Column('status', sa.TEXT(), nullable=True), sa.Column('private', sa.BOOLEAN(), nullable=True), sa.Column('readme', sa.TEXT(), nullable=True), sa.Column('publisher_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['publisher_id'], [u'publisher.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'publisher_id') ) op.create_index(op.f('ix_package_name'), 'package', ['name'], unique=False) op.create_index(op.f('ix_package_status'), 'package', ['status'], unique=False) op.create_table('publisher_user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('publisher_id', sa.Integer(), nullable=False), sa.Column('role', sa.TEXT(), nullable=False), sa.ForeignKeyConstraint(['publisher_id'], [u'publisher.id'], ), sa.ForeignKeyConstraint(['user_id'], [u'user.id'], ), sa.PrimaryKeyConstraint('id', 'user_id', 'publisher_id') ) ### end Alembic commands ###
def upgrade(): op.create_table('artifact_set_members', sa.Column('set_id', sa.VARCHAR(length=40), nullable=False), sa.Column('artifact_id', sa.VARCHAR(length=40), nullable=False), sa.PrimaryKeyConstraint('set_id', 'artifact_id')) op.create_table('artifact_sets', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('set_id', sa.VARCHAR(length=40), nullable=True), sa.Column('name', sa.VARCHAR(length=1000), nullable=True), sa.Column('created_at', pg.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table('runs', sa.Column('id', sa.VARCHAR(length=40), nullable=False), sa.Column('hostname', sa.VARCHAR(length=256), nullable=True), sa.Column('info', pg.JSONB(), nullable=True), sa.Column('created_at', pg.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table('artifacts', sa.Column('id', sa.VARCHAR(length=40), nullable=False), sa.Column('value_id', sa.VARCHAR(length=50), nullable=True), sa.Column('run_id', sa.VARCHAR(length=40), nullable=True), sa.Column('name', sa.VARCHAR(length=1000), nullable=True), sa.Column('version', sa.INTEGER(), nullable=True), sa.Column('fn_module', sa.VARCHAR(length=100), nullable=True), sa.Column('fn_name', sa.VARCHAR(length=100), nullable=True), sa.Column('composite', sa.BOOLEAN(), nullable=True), sa.Column('value_id_duration', sa.FLOAT(), nullable=True), sa.Column('compute_duration', sa.FLOAT(), nullable=True), sa.Column('hash_duration', sa.FLOAT(), nullable=True), sa.Column('computed_at', pg.TIMESTAMP(), nullable=True), sa.Column('added_at', pg.TIMESTAMP(), nullable=True), sa.Column('input_artifact_ids', pg.ARRAY(pg.VARCHAR(length=40)), nullable=True), sa.Column('inputs_json', pg.JSONB(), nullable=True), sa.Column('serializer', sa.VARCHAR(length=128), nullable=True), sa.Column('load_kwargs', pg.JSONB(), nullable=True), sa.Column('dump_kwargs', pg.JSONB(), nullable=True), sa.Column('custom_fields', pg.JSONB(), nullable=True), sa.ForeignKeyConstraint(['run_id'], ['runs.id'], ), sa.PrimaryKeyConstraint('id'))