migration failed: index UQE_buckets_id already exists #2243
Loading…
x
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?
Description
When attempting to test the most recent unstable build I get the following error in the container logs and Vikunja won't start
Upgrading from Version: v0.23.0 (according to the web UI) to whatever the most recent 'unstable' image is. Portainer shows this for the image hash sha256:8c1e61427c3fdfc5316654b6ec8b395117929562b11fbf1a49614e9564790df6
Vikunja Version
0.23.0
Browser and version
n/a
Can you reproduce the bug on the Vikunja demo site?
No
Screenshots
No response
Are you using sqlite?
Yes. Sorry forgot to mention that.
Should be fixed with
ca33c0b2bc
- please check with the next unstable build (ready in ~45min) if the problem went away.Same error still exists I'm afraid. This is my compose file for reference and the db and files directories were copied over from a working vikunja:lastest instance.
compose.yaml
.env
Docker images
Docker log output
I get exactly the same error with a freshly pulled :unstable image when I start with a copy of my productive Sqlite vikunja.db.
Should be fixed in
bf3c8ac9da
. Please check with the next unstable build (ready in ~45min).If the migration went through, please run this on your db to ensure the index is present:
Still the same error for me unfortunately.
@BV which Vikunja version is that?
If you mean which version am I upgrading from I can't get the version number right now as I'm on the road and having trouble with my VPN. Whatever version of the
:latest
image is show in the comment above with hash 255441410643. I was pretty sure it was up to date (i.e. re-pulled within the last week) but I see the hash does not match what's show for the latest tag in docker hub. It should be very recent though.I can verify once I resolve the VPN issues or return home in a day or two.
Version: v0.23.0 is what I'm running and trying to upgrade from.
The image is current according to
docker pull
. The number shown bydocker images
is the image ID whereas in docker hubs it's actual hashes for the index digest, manifest digest, etc.Current
:latest
in docker hubSame here in current vikunja/vikunja:unstable: "vikunja/vikunja@sha256:3de36d8c780791262f5b99828260f653c064e21139037f0293db9ec0eba4f523"
After looking at https://kolaente.dev/vikunja/vikunja/src/branch/main/pkg/migration/20240315093418.go#L102 I believe that this line should be moved a little downwards, after renaming buckets_dg_tmp to buckets.
I need the actual Vikunja version of the version you've upgraded to, not the docker image hash. You can get it in the web frontend top left -> about or by running
vikunja version
in the docker container. The docker image hash changes every time a new version is published and depends on the actual image you're pulling (by arch).What I find interesting about the migration is the index will only ever be created if it does not exist, that means it should not throw an error about the index already existing…
Vikunja version: v0.23.0+523-2d084c091e
I think line 102 in https://kolaente.dev/vikunja/vikunja/src/branch/main/pkg/migration/20240315093418.go#L102 does not do anything.
In line 104 you drop the table anyway. I guess the DROP index should be between lines 107 and 109.
Does it work if you execute the statement manually in that way?
Yes, that seems to work. After the migration has failed, I ran the lines 85-110 manually and got no error. Strange.
If you then run the migration again, does that work?
No:
Migration failed: migration 20240315093418 failed: Cannot add a NOT NULL column with default value NULL
Maybe in line https://kolaente.dev/vikunja/vikunja/src/branch/main/pkg/migration/20240315093418.go#L102
it should be
drop index UQE_buckets_id;
(withoutbuckets.
)When I perform this statement on the database manually before starting the container the migration runs successfully.
I've changed what you suggested in
e88f95e501
. Please check if that works with the next unstable build.No, that wasn't the reason, unfortunately. The error does still occur.
I did some debugging locally. The error is thrown from line 40.
With
VIKUNJA_LOG_DATABASE=on
it says:I can remove
unique pk
from line 26 and the migration runs successfully. (Even without IF EXISTS / IF NOT EXISTS in the subsequent SQL.)Can you please have another look at it?
Huh. This is a bug in sqlite then, because it should not try to create an index when it already exists.
I'll take another look.
I didn't really figure out why it did not work, but I went ahead and removed the
unique pk
from the struct ina38e768895
, as you suggested. Does that fix it for you?Yes. With the recent unstable image I can migrate my 0.23.0 database file.