Bug 29495: Drop issue_id constraint from return_claims
This patch removes the issue_id constraint from return_claims.
Due to the nature of our dual table approach to checkouts/old_checkouts
we can't safely hae this constraint and not lose data. Prior to this
commit, when an item is checked in we move the checkout from checkouts
to old_checkouts.. this therefore triggers the delete of the issue_id
from the return_claims table as described by the foreign key constraint.
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit f8125ecc18)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
parent
f10783a84c
commit
d26dc0867c
|
|
@ -0,0 +1,10 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if ( foreign_key_exists( 'return_claims', 'issue_id' ) ) {
|
||||
$dbh->do(q{
|
||||
ALTER TABLE return_claims DROP FOREIGN KEY issue_id
|
||||
});
|
||||
}
|
||||
|
||||
NewVersion( $DBversion, 29495, "Issue link is lost in return claims when using 'MarkLostItemsAsReturned'");
|
||||
}
|
||||
|
|
@ -4578,7 +4578,6 @@ CREATE TABLE return_claims (
|
|||
PRIMARY KEY (`id`),
|
||||
KEY `itemnumber` (`itemnumber`),
|
||||
CONSTRAINT UNIQUE `issue_id` ( issue_id ),
|
||||
CONSTRAINT `issue_id` FOREIGN KEY (`issue_id`) REFERENCES `issues` (`issue_id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
|
|
|
|||
Loading…
Reference in New Issue