def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'last_name')
op.drop_column('users', 'first_name')
### end Alembic commands ###
with op.batch_alter_table("notes") as batch_op:
batch_op.drop_constraint(
"notes_author_id_fkey", type_="foreignkey")
with op.batch_alter_table("notebooks") as batch_op:
batch_op.drop_constraint(
"notebooks_author_id_fkey", type_="foreignkey")
op.create_foreign_key(
"notes_author_id_fkey", "notes", "users",
["author_id"], ["id"], ondelete="CASCADE")
op.create_foreign_key(
"notebooks_author_id_fkey", "notebooks", "users",
["author_id"], ["id"], ondelete="CASCADE")
3a37e844b277_alter_constraints.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录