[英]How do I delete a similar alembic version?
When I am trying to do 当我试图做
alembic upgrade head
I am getting this error: 我收到此错误:
ERROR [alembic.util.messaging] Online migration expected to match one row when updating '3aae6532b560' to 'a1d8dae7cc' in 'alembic_version'; 2 found
FAILED: Online migration expected to match one row when updating '3aae6532b560'
to 'a1d8dae7cc' in 'alembic_version'; 2 found
alembic current
gives two similar versions of alembic like: 给出了两个类似的alembic版本:
3aae6532b560
3aae6532b560
How do I delete one of the similar versions of alembic, ie a copied version? 如何删除alembic的相似版本之一,即复制版本?
alembic history doesn't show any messed up output. Alembic历史记录未显示任何混乱的输出。
Thanks! 谢谢!
Alembic version is stored within your database in alembic_version table. Alembic版本存储在数据库中的alembic_version表中。 I see that you have two self same rows inside the table. 我看到您在表中有两个相同的行。
You can do something like this: 您可以执行以下操作:
DELETE FROM alembic_version WHERE version_num='3aae6532b560';
INSERT INTO alembic_version VALUES ('3aae6532b560');
Above query could be done in one query by limiting number of deleted rows, but limiting within DELETE query is different between different databases engines. 可以通过限制已删除的行数来在一个查询中完成以上查询,但是不同数据库引擎之间的DELETE查询限制是不同的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.