Trying to update my database. idm field is not being added in the aime_card table #156
Labels
No Label
aimedb
bug
chuni
chusan
cxb
database
diva
doc
duplicate
enhancement
frontend
help wanted
idac
idz
invalid
maidx
ongeki
pokken
question
seen
system
testing
wacca
waiting
wip
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Hay1tsme/artemis#156
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
So i tried running python dbutils.py upgrade and yet the new idm field in aime_card is not being added. Is there another way to upgrade the database?
what do you mean by not being added? Is the chip_id column also not being added?
Yes. Both not being added to my existing database.
Sounds like the upgrade script isn't running. Does the file
48f4acc43a7e_card_add_idm_chip_id.py
exist incore/data/alembic/versions
?just checked inside the docker container and yes the file does exist
what's the output if you run
python dbutils.py upgrade
?INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
and you're certain you have core.yaml configured correctly? I can't reproduce this issue at all.
i think. Games connected fine and could login before the idm commit. Now when trying to login it complains about those 2 fields not being found. So maybe something went wrong trying to migratie to the idm migration
hmmmm, what is the value of the
version_num
column in thealembic_version
table?it says 48f4acc43a7e
Try downgrading with
python dbutils.py downgrade -v 1e150d16ab6b
and then upgrading again.That gives :
Whoops, this was a bug on my part, please pull latest develop and try running the downgrade again.
Can't drop index
/app# python dbutils.py downgrade -v 1e150d16ab6b
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running downgrade 48f4acc43a7e -> 1e150d16ab6b, card_add_idm_chip_id
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 179, in execute
res = self._query(mogrified_query)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 330, in _query
db.query(q)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 261, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1091, "Can't DROP INDEX
chip_id
; check that it exists")The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/dbutils.py", line 55, in
data.schema_downgrade(args.version)
File "/app/core/data/database.py", line 125, in schema_downgrade
self.__alembic_cmd(
File "/app/core/data/database.py", line 94, in __alembic_cmd
alembic.config.main(argv=alembicArgs)
File "/usr/local/lib/python3.9/site-packages/alembic/config.py", line 641, in main
CommandLine(prog=prog).main(argv=argv)
File "/usr/local/lib/python3.9/site-packages/alembic/config.py", line 631, in main
self.run_cmd(cfg, options)
File "/usr/local/lib/python3.9/site-packages/alembic/config.py", line 608, in run_cmd
fn(
File "/usr/local/lib/python3.9/site-packages/alembic/command.py", line 449, in downgrade
script.run_env()
File "/usr/local/lib/python3.9/site-packages/alembic/script/base.py", line 583, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "", line 850, in exec_module
File "", line 228, in call_with_frames_removed
File "./env.py", line 81, in
run_migrations_online()
File "./env.py", line 76, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/usr/local/lib/python3.9/site-packages/alembic/runtime/environment.py", line 948, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python3.9/site-packages/alembic/runtime/migration.py", line 627, in run_migrations
step.migration_fn(**kw)
File "/app/core/data/alembic/versions/48f4acc43a7e_card_add_idm_chip_id.py", line 38, in downgrade
op.drop_constraint("chip_id", 'aime_card', type='unique')
File "", line 8, in drop_constraint
File "", line 3, in drop_constraint
File "/usr/local/lib/python3.9/site-packages/alembic/operations/ops.py", line 222, in drop_constraint
return operations.invoke(op)
File "/usr/local/lib/python3.9/site-packages/alembic/operations/base.py", line 445, in invoke
return fn(self, operation)
File "/usr/local/lib/python3.9/site-packages/alembic/operations/toimpl.py", line 201, in drop_constraint
operations.impl.drop_constraint(
File "/usr/local/lib/python3.9/site-packages/alembic/ddl/mysql.py", line 157, in drop_constraint
super().drop_constraint(const)
File "/usr/local/lib/python3.9/site-packages/alembic/ddl/impl.py", line 350, in drop_constraint
self._exec(schema.DropConstraint(const))
File "/usr/local/lib/python3.9/site-packages/alembic/ddl/impl.py", line 207, in _exec
return conn.execute(construct, multiparams)
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1380, in execute
return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection
return connection._execute_ddl(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1472, in _execute_ddl
ret = self._execute_context(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
self.handle_dbapi_exception(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2124, in handle_dbapi_exception
util.raise(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise
raise exception
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 179, in execute
res = self._query(mogrified_query)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 330, in _query
db.query(q)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 261, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1091, "Can't DROP INDEX
chip_id
; check that it exists")[SQL: ALTER TABLE aime_card DROP INDEX chip_id]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
i put version_num in alembic_version to 1e150d16ab6b now upgrading to idm and chip_id are added now stuck on the next migration with sao one.
so what im going to do is create a new database and insert all my data into it but now with a fresh db i get
Fixing that now, apologies
This has been fixed by
c13b096190
Please try again.
Tested again with new db. Works now thanks. Time to reimport my data
sounds good. Since it seems that you're good to go on this specific issue, Ill close this