Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.34.0-RC1 upgrade fails if Jethro has services for since-deleted congregations #940

Closed
jefft opened this issue Aug 19, 2023 · 2 comments
Closed

Comments

@jefft
Copy link
Contributor

jefft commented Aug 19, 2023

Attempting to upgrade my 2.33.0 Jethro to 2.34.0-RC1, I get an error running upgrades/2023-upgrade-to-2.34.sql:

ERROR 1452 (23000) at line 44: Cannot add or update a child row: a foreign key constraint fails (`coastec_jethro`.`#sql
-alter-11ad5c-2baf5`, CONSTRAINT `service_congregationid` FOREIGN KEY (`congregationid`) REFERENCES `congregation` (`id
`))

The relevant line of SQL is tightening up the schema, so congregations cannot be deleted if they have associated services (#834):

ALTER TABLE service
ADD CONSTRAINT `service_congregationid` FOREIGN KEY (congregationid) REFERENCES congregation(id) ON DELETE RESTRICT;

Our Jethro did once have 3 temporary congregations, and a number of associated services.

I'm all for tightening the schema, but then the upgrade SQL needs to deal with the current messy reality somehow.

jefft added a commit to jefft/jethro-pmm that referenced this issue Aug 19, 2023
jefft added a commit to jefft/jethro-pmm that referenced this issue Aug 19, 2023
@jefft
Copy link
Contributor Author

jefft commented Aug 19, 2023

The attached PR (pls ignore the first) resolves this by recreating the deleted congregations, so the services are no longer dangling and the foreign key constraint can be applied.

@tbar0970
Copy link
Owner

tbar0970 commented Aug 20, 2023 via email

tbar0970 added a commit that referenced this issue Aug 23, 2023
#940 - recreate deleted congregations to keep the foreign key constraint happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants