CorrelAid / correlaid_website

Source code for the CorrelAid website
https://correlaid.org
3 stars 0 forks source link

can't create new items in projects #475

Closed friep closed 10 months ago

friep commented 10 months ago

I can't create new items in the projects collection and could not update a certain one (2019-01-MAP). ended up deleting it and tried to recreate it but still got the same error. See screenshot. @jstet maybe can you dig into the database and check whether there is indeed a duplicate ID? it's all very odd :(

Screenshot 2023-06-09 at 11 14 14

jstet commented 10 months ago

I think this has happened before, I ll try to fix it now https://github.com/CorrelAid/correlaid_website/issues/110

jstet commented 10 months ago

Yey easy fix. I dont know what causes this :S

friep commented 10 months ago

documenting for future me/us: i wanted to recreate the project and turns out it was not an issue of the projects table... i could create the project without adding either Local Chapters or Organizations - when i try to do either i get the ID has to be unique error. When i go into the respective M2M collections, i find "dangling" entries. when i delete them, i can add the LC. for the organization i haven't found a fix.

friep commented 10 months ago

@jstet maybe you can try your "fix" for the Oragnizations_Projects collection? 🤔

jstet commented 10 months ago
SELECT SETVAL('public."Organizations_Projects_id_seq"', (SELECT max(id) FROM public."Organizations_Projects"));
ALTER TABLE public."Organizations_Projects" ALTER COLUMN id SET DEFAULT nextval('"Organizations_Projects_id_seq"'::regclass);

fixed it for organitations, but doing the same to LCs caused a different error that I am working on now

jstet commented 10 months ago

Nvm it worked as well, forgot the "id_seq"

jstet commented 10 months ago

"Fixed" it. @friep could you please confirm this and close this issue if you think this is resolved?