INFO [alembic.runtime.migration] Running upgrade ee82678fcda1 -> a36ffbb6580e, Add index to parent_module_version column of analytics table
Traceback (most recent call last):
File "venv/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 535, in cmd_query
self._cmysql.query(query,
_mysql_connector.MySQLInterfaceError: Can't DROP 'fk_analytics_parent_module_version_module_version_id'; check that column/key exists
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
self.dialect.do_execute(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
File "venv/lib/python3.8/site-packages/mysql/connector/cursor_cext.py", line 269, in execute
result = self._cnx.cmd_query(stmt, raw=self._raw,
File "venv/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 540, in cmd_query
raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.ProgrammingError: 1091 (42000): Can't DROP 'fk_analytics_parent_module_version_module_version_id'; check that column/key exists
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "venv/bin/alembic", line 8, in <module>
sys.exit(main())
File "venv/lib/python3.8/site-packages/alembic/config.py", line 588, in main
CommandLine(prog=prog).main(argv=argv)
File "venv/lib/python3.8/site-packages/alembic/config.py", line 582, in main
self.run_cmd(cfg, options)
File "venv/lib/python3.8/site-packages/alembic/config.py", line 559, in run_cmd
fn(
File "venv/lib/python3.8/site-packages/alembic/command.py", line 320, in upgrade
script.run_env()
File "venv/lib/python3.8/site-packages/alembic/script/base.py", line 563, in run_env
util.load_python_file(self.dir, "env.py")
File "venv/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 92, in load_python_file
module = load_module_py(module_id, path)
File "venv/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 108, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "terrareg/alembic/env.py", line 82, in <module>
run_migrations_online()
File "terrareg/alembic/env.py", line 76, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "venv/lib/python3.8/site-packages/alembic/runtime/environment.py", line 851, in run_migrations
self.get_context().run_migrations(**kw)
File "venv/lib/python3.8/site-packages/alembic/runtime/migration.py", line 620, in run_migrations
step.migration_fn(**kw)
File "terrareg/alembic/versions/a36ffbb6580e_add_index_to_parent_module_version_.py", line 25, in upgrade
batch_op.create_index(op.f('ix_analytics_parent_module_version'), ['parent_module_version'], unique=False)
File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
next(self.gen)
File "venv/lib/python3.8/site-packages/alembic/operations/base.py", line 374, in batch_alter_table
impl.flush()
File "venv/lib/python3.8/site-packages/alembic/operations/batch.py", line 108, in flush
fn(*arg, **kw)
File "venv/lib/python3.8/site-packages/alembic/ddl/impl.py", line 387, in drop_index
self._exec(schema.DropIndex(index))
File "venv/lib/python3.8/site-packages/alembic/ddl/impl.py", line 193, in _exec
return conn.execute(construct, multiparams)
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1306, in execute
return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
File "venv/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection
return connection._execute_ddl(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1398, in _execute_ddl
ret = self._execute_context(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
self._handle_dbapi_exception(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
util.raise_(
File "venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
raise exception
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
self.dialect.do_execute(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
File "venv/lib/python3.8/site-packages/mysql/connector/cursor_cext.py", line 269, in execute
result = self._cnx.cmd_query(stmt, raw=self._raw,
File "venv/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 540, in cmd_query
raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
sqlalchemy.exc.ProgrammingError: (mysql.connector.errors.ProgrammingError) 1091 (42000): Can't DROP 'fk_analytics_parent_module_version_module_version_id'; check that column/key exists
[SQL:
DROP INDEX fk_analytics_parent_module_version_module_version_id ON analytics]
(Background on this error at: https://sqlalche.me/e/14/f405)