lnbits / cashu

MIT License
9 stars 3 forks source link

duplicate column name: Y #67

Open AbelLykens opened 8 months ago

AbelLykens commented 8 months ago

Describe the bug I upgraded to 0.12.2 (not sure from what version, has been a while since I updated). Now my logs keep saying "duplicate column name: Y".

To Reproduce Upgrade to 0.12.2.

Expected behavior No errors

Screenshots See logs below

Desktop:

Additional context Add any other context about the problem here.

Mar 07 08:03:06 srv112 poetry[33597]: [SQL: ALTER TABLE proofs_used ADD COLUMN Y TEXT]
Mar 07 08:03:06 srv112 poetry[33597]: (Background on this error at: http://sqlalche.me/e/13/e3q8)
Mar 07 08:03:06 srv112 poetry[33597]: 2024-03-07 08:03:06.53 | ERROR | lnbits.tasks:catch_everything_and_restart:52 | will restart the task in 5 seconds.
Mar 07 08:03:06 srv112 poetry[33597]: 2024-03-07 08:03:06.54 | DEBUG | lnbits.extensions.cashu.lib.cashu.core.migrations:run_migration:72 | Migrating mint db: m014_proofs_add_Y_column
Mar 07 08:03:06 srv112 poetry[33597]: 2024-03-07 08:03:06.54 | ERROR | lnbits.tasks:catch_everything_and_restart:50 | caught exception in background task:
Mar 07 08:03:06 srv112 poetry[33597]: 2024-03-07 08:03:06.54 | ERROR | lnbits.tasks:catch_everything_and_restart:51 | Traceback (most recent call last):
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
Mar 07 08:03:06 srv112 poetry[33597]:     self.dialect.do_execute(
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
Mar 07 08:03:06 srv112 poetry[33597]:     cursor.execute(statement, parameters)
Mar 07 08:03:06 srv112 poetry[33597]: sqlite3.OperationalError: duplicate column name: Y
Mar 07 08:03:06 srv112 poetry[33597]: The above exception was the direct cause of the following exception:
Mar 07 08:03:06 srv112 poetry[33597]: Traceback (most recent call last):
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/tasks.py", line 46, in catch_everything_and_restart
Mar 07 08:03:06 srv112 poetry[33597]:     await func()
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/extensions/cashu/tasks.py", line 12, in startup_cashu_mint
Mar 07 08:03:06 srv112 poetry[33597]:     await migrate_databases(db, migrations)
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/extensions/cashu/lib/cashu/core/migrations.py", line 102, in migrate_databases
Mar 07 08:03:06 srv112 poetry[33597]:     await run_migration(db, migrations_module)
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/extensions/cashu/lib/cashu/core/migrations.py", line 73, in run_migration
Mar 07 08:03:06 srv112 poetry[33597]:     await migrate(db)
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/extensions/cashu/lib/cashu/mint/migrations.py", line 414, in m014_proofs_add_Y_column
Mar 07 08:03:06 srv112 poetry[33597]:     await conn.execute(
Mar 07 08:03:06 srv112 poetry[33597]:   File "/opt/lnbits/lnbits/db.py", line 221, in execute
Mar 07 08:03:06 srv112 poetry[33597]:     return await self.conn.execute(
Mar 07 08:03:06 srv112 poetry[33597]:            ^^^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy_aio/base.py", line 291, in execute
Mar 07 08:03:06 srv112 poetry[33597]:     rp = await self._run_in_thread(
Mar 07 08:03:06 srv112 poetry[33597]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy_aio/base.py", line 234, in _run_in_thread
Mar 07 08:03:06 srv112 poetry[33597]:     return await _self._worker.run(_func, args, kwargs)
Mar 07 08:03:06 srv112 poetry[33597]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy_aio/asyncio.py", line 70, in run
Mar 07 08:03:06 srv112 poetry[33597]:     return request.response.unwrap()
Mar 07 08:03:06 srv112 poetry[33597]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/outcome/_impl.py", line 213, in unwrap
Mar 07 08:03:06 srv112 poetry[33597]:     raise captured_error
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1003, in execute
Mar 07 08:03:06 srv112 poetry[33597]:     return self._execute_text(object_, multiparams, params)
Mar 07 08:03:06 srv112 poetry[33597]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1172, in _execute_text
Mar 07 08:03:06 srv112 poetry[33597]:     ret = self._execute_context(
Mar 07 08:03:06 srv112 poetry[33597]:           ^^^^^^^^^^^^^^^^^^^^^^
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
Mar 07 08:03:06 srv112 poetry[33597]:     self._handle_dbapi_exception(
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
Mar 07 08:03:06 srv112 poetry[33597]:     util.raise_(
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
Mar 07 08:03:06 srv112 poetry[33597]:     raise exception
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
Mar 07 08:03:06 srv112 poetry[33597]:     self.dialect.do_execute(
Mar 07 08:03:06 srv112 poetry[33597]:   File "/home/bitcoin/.cache/pypoetry/virtualenvs/lnbits-cKTwH27K-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
Mar 07 08:03:06 srv112 poetry[33597]:     cursor.execute(statement, parameters)
Mar 07 08:03:06 srv112 poetry[33597]: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: Y
Mar 07 08:03:06 srv112 poetry[33597]: [SQL: ALTER TABLE proofs_used ADD COLUMN Y TEXT]
Mar 07 08:03:06 srv112 poetry[33597]: (Background on this error at: http://sqlalche.me/e/13/e3q8)
AbelLykens commented 8 months ago

@callebtc thoughts? 🥰

newtonick commented 8 months ago

I had this same error until I removed the cashu extension.

AbelLykens commented 8 months ago

Hope @callebtc can take a look 🙂