Casvt / MIND

A simple self hosted reminder application that can send push notifications to your device. Set the reminder and forget about it!
https://casvt.github.io/MIND/
GNU General Public License v3.0
201 stars 10 forks source link

upgrade to v1.3.0 breaks container #51

Closed cybermcm closed 1 year ago

cybermcm commented 1 year ago

Description of the bug upgrade to latest version 1.3.0 breaks running container

To Reproduce Was on latest (1.2.1) and now on 1.3.0, internal upgrade script seems to break things

Expected behaviour error free upgrade

Screenshots

mind  | Migrating database to newer version...
mind  | Traceback (most recent call last):
mind  |   File "/app/MIND.py", line 112, in <module>
mind  |     MIND()
mind  |   File "/app/MIND.py", line 97, in MIND
mind  |     setup_db()
mind  |   File "/app/backend/db.py", line 272, in setup_db
mind  |     migrate_db(current_db_version)
mind  |   File "/app/backend/db.py", line 105, in migrate_db
mind  |     cursor.executescript("""
mind  | sqlite3.OperationalError: no such column: notification_service

Version info Docker on Debian

Additional context a notification service was set up in 1.2.1

Casvt commented 1 year ago

It should be safe to temporarily revert back to v1.2.1 until I fix it

Casvt commented 1 year ago

I've double checked the migration code but really couldn't find any problem with it that could cause the error. Could you please privately share your database file with me, if you feel comfortable with that. You could DM me the file via Discord (Casvt#6462) for example.

cybermcm commented 1 year ago

@Casvt: I can send you my DB, there is only one entry (one notification entry). I added you on Discord (every time I use Discord I'm reminded that I'm getting old, this blinking stuff is way too much for me ;-))

cybermcm commented 1 year ago

just a quick update. Did a fresh install with a fresh DB on 1.2.1 (and one reminder service) and then "upgrade" to latest -> broken. Starting fresh with 1.3.0 aka latest -> working. I started fresh with 1.3.0, so this issue has only low priority for me now but maybe interesting for further updates.

Casvt commented 1 year ago

I found the problem, though I don't know how you got into that situation.

The database was v4 and it was migrating to v5. However, the "reminders" table in your database was already v5. So it was migrating but failed because the table was a version that it shouldn't've been, it already was the version that we were migrating to. So the database version noted in the database (v4) didn't match the actual state of the database (v5). And how this has happened, I don't know.

The only thing that I can think of is that you updated the container, started it, it started migrating, completed but then you stopped it exactly after migrating but before updating the database version inside. And then next time you run it the database version reports v4 while it's actually already v5. But that's a very narrow time frame to stop in (like, milliseconds).

It think we'll just leave an open ending to this issue...

dhanadhan commented 1 year ago

@Casvt I just updated my container from 1.2.1 to 1.3.0, and I am running into the same issue. I can't access the container using the IP:port. Was there a fix for this issue? I read what you mentioned, but don't know how to fix it.

Migrating database to newer version...
Traceback (most recent call last):
  File "/app/MIND.py", line 112, in <module>
    MIND()
  File "/app/MIND.py", line 97, in MIND
    setup_db()
  File "/app/backend/db.py", line 272, in setup_db
    migrate_db(current_db_version)
  File "/app/backend/db.py", line 105, in migrate_db
    cursor.executescript("""
sqlite3.OperationalError: no such column: notification_service
Migrating database to newer version...
Traceback (most recent call last):
  File "/app/MIND.py", line 112, in <module>
    MIND()
  File "/app/MIND.py", line 97, in MIND
    setup_db()
  File "/app/backend/db.py", line 272, in setup_db
    migrate_db(current_db_version)
  File "/app/backend/db.py", line 105, in migrate_db
    cursor.executescript("""
sqlite3.OperationalError: no such column: notification_service
Casvt commented 1 year ago

I can reproduce now.

Casvt commented 1 year ago

Issue fixed. Actually two issues fixed at the same time. If this error wasn't there, you would've lost all your reminders because of the other error that I accidentally found while trying to fix this one. So a blessing in disguise. Please pull the latest docker container (v1.3.1) to get the fix :)