kohastructure defines it as SET NULL but this upgrade 'decided' differently: $DBversion = "3.23.00.055"; ALTER TABLE old_reserves ADD CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE; I think we should go for SET NULL here.
Created attachment 133106 [details] [review] Bug 30497: Recreate old_reserves_ibfk_4 when it cascades Test plan: Drop old_reserves_ibfk_4. Add back with: alter table old_reserves ADD CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE; Run dbrev. Check that constraint has been replaced by SET NULL. Run dbrev again. No changes. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
QAing my own patch, DROP CONSTRAINT is bad, should be DROP FOREIGN KEY
Created attachment 139680 [details] [review] Bug 30497: Recreate old_reserves_ibfk_4 when it cascades Test plan: Drop old_reserves_ibfk_4. Add back with: alter table old_reserves ADD CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE; Run dbrev. Check that constraint has been replaced by SET NULL. Run dbrev again. No changes. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT 23-08-22 Replaced DROP CONSTRAINT]
Taking this one also to the next level. Architectural, close to trivial.
Created attachment 140073 [details] [review] Bug 30497: Recreate old_reserves_ibfk_4 when it cascades Test plan: Drop old_reserves_ibfk_4. Add back with: alter table old_reserves ADD CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE; Run dbrev. Check that constraint has been replaced by SET NULL. Run dbrev again. No changes. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT 23-08-22 Replaced DROP CONSTRAINT] Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 22.11. Nice work everyone, thanks!