jovandeginste / workout-tracker

A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities
Other
965 stars 30 forks source link

Unable to delete things. #321

Open mortimus1987 opened 2 weeks ago

mortimus1987 commented 2 weeks ago

I have uploaded a brief test track, to check the import functionality from my phone. Having it confirmed it worked, I attempted to delete the workout but received the following error:

Something went wrong: ERROR: update or delete on table "map_data" violates foreign key constraint "fk_map_data_details" on table "map_data_details" (SQLSTATE 23503)

I get the a similar error when attempting to delete the initial admin user (after creating another user and ensuring they have admin privileges) but for "fk_users_profile" on table "profiles".

I am using a docker compose deployment with PostGres 16 alpine as the database.

jovandeginste commented 2 weeks ago

Can you check the exact version you are running?

mortimus1987 commented 2 weeks ago

The docker image is the :latest tag. Workout tracker itself reports "branch master (c6d4ea03)"

jovandeginste commented 2 weeks ago

Would you be able to reproduce this with sqlite as the database engine?

mortimus1987 commented 2 weeks ago

No; using sqlite I seem to be able to delete both workouts and users with no issue, so that suggests its PostGres related.

Interestingly, initially the docker container kept crashing when I tried to use sqlite instead of PG. After checking the logs I realised this was because my JWT environment variable was a mess with brackets and spaces etc. (failure of variable substitution by ansible when I deployed the compose stack because of my fat fingers). I don't know if thats expected or not, but using the exact same env var the container started fine when using postgres.

Just to be clear, I corrected the JWT var and made a new PG database, and the inability to delete persists, so its not related, but thought it worth mentioning in case its also unintentional behaviour.

jovandeginste commented 2 weeks ago

Then I will need to test with a postgres backend

jovandeginste commented 1 week ago

Can you check the latest master image?

mortimus1987 commented 1 week ago

Using the latest docker container (6d657465) and I have been able to delete the administrator user successfully. However, attempting to delete the workout I uploaded as a test still fails with the same error.

jovandeginste commented 1 week ago

Using the latest docker container (6d65746) and I have been able to delete the administrator user successfully. However, attempting to delete the workout I uploaded as a test still fails with the same error.

Was this a new test, or the previous database content?