Bug 15497: Add itemtypes_branches table and atomic update

Sponsored-by: Northeast Kansas Library System
Sponsored-by: Southeast Kansas Library System
Sponsored-by: Central Kansas Library System
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Agustin Moyano 2019-07-04 01:30:17 -03:00 committed by Martin Renvoize
parent a07e7ddb8b
commit 7a38522a1b
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,17 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
if( !TableExists( 'itemtypes_branches' ) ) {
$dbh->do( "
CREATE TABLE itemtypes_branches( -- association table between authorised_values and branches
itemtype VARCHAR(10) NOT NULL,
branchcode VARCHAR(10) NOT NULL,
FOREIGN KEY (itemtype) REFERENCES itemtypes(itemtype) ON DELETE CASCADE,
FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
");
}
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 15497 - Add itemtypes_branches table)\n";
}

View file

@ -4287,6 +4287,18 @@ shortcut_keys varchar(80) NOT NULL,
PRIMARY KEY (shortcut_name) PRIMARY KEY (shortcut_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table itemtypes_branches
--
DROP TABLE IF EXISTS itemtypes_branches;
CREATE TABLE itemtypes_branches( -- association table between authorised_values and branches
itemtype VARCHAR(10) NOT NULL,
branchcode VARCHAR(10) NOT NULL,
FOREIGN KEY (itemtype) REFERENCES itemtypes(itemtype) ON DELETE CASCADE,
FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;