def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('location',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('location', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('location')
)
op.add_column('event', sa.Column('location_id', sa.Integer(), nullable=True))
op.drop_constraint('event_title_key', 'event', type_='unique')
op.create_foreign_key(None, 'event', 'location', ['location_id'], ['id'])
op.drop_column('event', 'title')
# ### end Alembic commands ###
python类drop_constraint()的实例源码
5f6302b63190_remove_event_title_and_create_location_.py 文件源码
项目:occrp-timeline-tool
作者: datamade
项目源码
文件源码
阅读 23
收藏 0
点赞 0
评论 0
5f6302b63190_remove_event_title_and_create_location_.py 文件源码
项目:occrp-timeline-tool
作者: datamade
项目源码
文件源码
阅读 23
收藏 0
点赞 0
评论 0
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('event', sa.Column('title', sa.VARCHAR(), autoincrement=False, nullable=False))
op.drop_constraint(None, 'event', type_='foreignkey')
op.create_unique_constraint('event_title_key', 'event', ['title'])
op.drop_column('event', 'location_id')
op.drop_table('location')
# ### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('podcast_feed_key', 'podcast', type_='unique')
op.drop_constraint('podcast_name_key', 'podcast', type_='unique')
op.add_column('tag', sa.Column('name', sa.String(), nullable=False))
op.create_index(op.f('ix_tag_name'), 'tag', ['name'], unique=True)
### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.alter_column('episode', 'title',
existing_type=sa.VARCHAR(),
nullable=False)
op.create_index(op.f('ix_episode_link'), 'episode', ['link'], unique=True)
op.drop_constraint('episode_link_key', 'episode', type_='unique')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('podcast', sa.Column('language', sa.VARCHAR(length=5), autoincrement=False, nullable=True))
op.drop_constraint(None, 'podcast', type_='foreignkey')
op.drop_column('podcast', 'language_id')
op.drop_index(op.f('ix_podcast_language_id'), table_name='podcast_language')
op.drop_table('podcast_language')
### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('topic_suggestion_podcast_id_fkey', 'topic_suggestion', type_='foreignkey')
op.drop_column('topic_suggestion', 'podcast_id')
### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('episode_title_key', 'episode', type_='unique')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
# op.drop_constraint(None, 'tv_serie', type_='unique')
op.drop_column('tv_serie', 'year')
### end Alembic commands ###
28b23145af40_add_is_default_flag_to_kubes.py 文件源码
项目:kuberdock-platform
作者: cloudlinux
项目源码
文件源码
阅读 30
收藏 0
点赞 0
评论 0
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('kubes_is_default_key', 'kubes', type_='unique')
op.drop_column('kubes', 'is_default')
### end Alembic commands ###
56ab56a9ac5_change_settings_schema_and_add_initial_.py 文件源码
项目:kuberdock-platform
作者: cloudlinux
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def downgrade():
op.add_column('system_settings', sa.Column('created', sa.DateTime, nullable=False))
op.add_column('system_settings', sa.Column('deleted', sa.DateTime, nullable=True))
op.drop_column('system_settings', 'label')
op.drop_column('system_settings', 'description')
op.drop_column('system_settings', 'placeholder')
op.drop_constraint('uq_system_settings_name', 'system_settings')
2df8c40ab250_add_default_package_flag.py 文件源码
项目:kuberdock-platform
作者: cloudlinux
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def downgrade():
op.drop_constraint('packages_is_default_key', 'packages', type_='unique')
op.drop_column('packages', 'is_default')
8d3aed3e74c_add_settings_groups.py 文件源码
项目:kuberdock-platform
作者: cloudlinux
项目源码
文件源码
阅读 17
收藏 0
点赞 0
评论 0
def downgrade():
conn = op.get_bind()
op.add_column('predefined_apps', sa.Column(
'user_id',
sa.Integer,
sa.ForeignKey('users.id'),
nullable=False,
server_default='1'))
op.drop_column('pods', 'template_plan_name')
op.drop_constraint('resource_role_name_unique', 'rbac_permission')
op.drop_column('system_settings', 'setting_group')
30ad174aa45a_add_relation_between_node_and_ippool.py 文件源码
项目:kuberdock-platform
作者: cloudlinux
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(u'ippool_node_id_fkey', 'ippool', type_='foreignkey')
op.drop_column('ippool', 'node_id')
### end Alembic commands ###
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('Comment_File_id_fkey', 'Comment', type_='foreignkey')
op.drop_constraint('Comment_User_id_fkey', 'Comment', type_='foreignkey')
op.create_foreign_key('Comment_User_id_fkey', 'Comment', 'User', ['User_id'], ['id'], ondelete='CASCADE')
op.create_foreign_key('Comment_File_id_fkey', 'Comment', 'File', ['File_id'], ['id'], ondelete='CASCADE')
op.drop_index('ix_LinterComment_File_id', table_name='LinterComment')
op.drop_constraint('LinterComment_File_id_fkey', 'LinterComment', type_='foreignkey')
op.create_index(op.f('ix_LinterComment_File_id'), 'LinterComment', ['File_id'], unique=False)
op.create_foreign_key('LinterComment_File_id_fkey', 'LinterComment', 'File', ['File_id'], ['id'], ondelete='CASCADE')
op.drop_constraint('LinterInstance_Work_id_fkey', 'LinterInstance', type_='foreignkey')
op.create_foreign_key('LinterInstance_Work_id_fkey', 'LinterInstance', 'Work', ['Work_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_LinterComment_File_id'), table_name='LinterComment')
op.drop_constraint('LinterComment_File_id_fkey', 'LinterComment', type_='foreignkey')
op.create_foreign_key('LinterComment_File_id_fkey', 'LinterComment', 'File', ['File_id'], ['id'])
op.create_index('ix_LinterComment_File_id', 'LinterComment', ['File_id'], unique=False)
op.drop_constraint('Comment_File_id_fkey', 'Comment', type_='foreignkey')
op.drop_constraint('Comment_User_id_fkey', 'Comment', type_='foreignkey')
op.create_foreign_key('Comment_User_id_fkey', 'Comment', 'User', ['User_id'], ['id'])
op.create_foreign_key('Comment_File_id_fkey', 'Comment', 'File', ['File_id'], ['id'])
op.drop_constraint('LinterInstance_Work_id_fkey', 'LinterInstance', type_='foreignkey')
op.create_foreign_key('LinterInstance_Work_id_fkey', 'LinterInstance', 'Work', ['Work_id'], ['id'])
# ### end Alembic commands ###
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('User', sa.Column('username', sa.Unicode(), nullable=False))
op.alter_column('User', 'email',
existing_type=sa.VARCHAR(),
nullable=False)
op.create_index(op.f('ix_User_username'), 'User', ['username'], unique=True)
op.drop_constraint('User_email_key', 'User', type_='unique')
# ### end Alembic commands ###
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('File_Work_id_fkey', 'File', type_='foreignkey')
op.create_foreign_key('File_Work_id_fkey', 'File', 'Work', ['Work_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('File_Work_id_fkey', 'File', type_='foreignkey')
op.create_foreign_key('File_Work_id_fkey', 'File', 'Work', ['Work_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('GradeHistory_Work_id_fkey', 'GradeHistory', type_='foreignkey')
op.create_foreign_key('GradeHistory_Work_id_fkey', 'GradeHistory', 'Work', ['Work_id'], ['id'])
# ### end Alembic commands ###
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('event_token_key', 'event', type_='unique')
op.drop_column('event', 'token')
# ### end Alembic commands ###