当upgrade失败后,如何回退到之前的迁移版本

本文介绍了在数据库迁移过程中,如果upgrade步骤遇到错误导致失败,如何检查当前版本,回退到之前的数据库迁移版本,并重新执行migrate和upgrade的详细步骤。
摘要由CSDN通过智能技术生成

 migrate后upgrade失败后的报错:

(vpp_agent_venv3.7) [root@localhost source]# python app-migrate.py db migrate
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.autogenerate.compare] Detected removed index 'ix_in_router_manager_room_id' on 'in_router_manager'
INFO  [alembic.autogenerate.compare] Detected removed foreign key (room_id)(id) on table in_router_manager
INFO  [alembic.autogenerate.compare] Detected removed column 'in_router_manager.room_id'
  Generating /srv/web_develop/vpp_agent_dev/agent/source/migrations/versions/8400cd3396af_.py ... done
(vpp_agent_venv3.7) [root@localhost source]# python app-migrate.py db upgrade
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 48a794328fe9 -> 8400cd3396af, empty message
Traceback (most recent call last):
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
    context)
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
    cursor.execute(statement, parameters)
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/connections.py", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
    result.read()
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/connections.py", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/srv/vpp_agent_venv3.7/lib/python3.7/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/srv/vpp_agent_ven
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值