Bug 36993: Upgrade fails at 23.12.00.023 [Bug 32132]
authorEmmi Takkinen <emmi.takkinen@koha-suomi.fi>
Fri, 31 May 2024 09:39:57 +0000 (12:39 +0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 5 Jun 2024 13:33:54 +0000 (14:33 +0100)
commit309127226fb5a308e744ed4011d407e4ec3bed28
treee51e6ad2146426b5c41633c96d31c99b096fa858
parent1c779aaca820b8dd2edeab3f3369ac342dadb089
Bug 36993: Upgrade fails at 23.12.00.023 [Bug 32132]

Database update fails on some databases because of
foreign key constraint error. This comes from attempt
to make column aqbudgets.budget_period_id not accept
NULL values. Update also fails if there are rows where
column aqbudgets.budget_period_id doesn't match any
values in aqbudgetperiods.budget_period_id.

To test:
1. Remove changes made in bug 32132 and downgrade your database:
- ALTER TABLE aqbudgets MODIFY COLUMN `budget_period_id` INT(11) NULL;
- UPDATE aqbudgets SET budget_period_id = NULL
WHERE budget_period_id IN(SELECT budget_period_id FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget");
- DELETE FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget";
- UPDATE systempreferences SET value="23.1200022" WHERE variable = "Version;
2. Upgrade your database (e.g. running installer/data/mysql/updatedatabase.pl)
=> Update fails on foreign key constraint error.
4. Apply this patch.
5. Try to update your database again.
=> Database should now be upgraded succesfully.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
installer/data/mysql/db_revs/231200023.pl