Lines 1622-1627
DROP TABLE IF EXISTS `issues`;
Link Here
|
1622 |
CREATE TABLE `issues` ( -- information related to check outs or issues |
1622 |
CREATE TABLE `issues` ( -- information related to check outs or issues |
1623 |
`issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table |
1623 |
`issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table |
1624 |
`borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
1624 |
`borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
|
|
1625 |
`issuer` int(11), -- foreign key, linking this to the borrowers table for the user who checked out this item |
1625 |
`itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out |
1626 |
`itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out |
1626 |
`date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) |
1627 |
`date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) |
1627 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
1628 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
Lines 1643-1649
CREATE TABLE `issues` ( -- information related to check outs or issues
Link Here
|
1643 |
KEY `branchcode_idx` (`branchcode`), |
1644 |
KEY `branchcode_idx` (`branchcode`), |
1644 |
KEY `bordate` (`borrowernumber`,`timestamp`), |
1645 |
KEY `bordate` (`borrowernumber`,`timestamp`), |
1645 |
CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
1646 |
CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
1646 |
CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE |
1647 |
CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
|
|
1648 |
CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE |
1647 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1649 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1648 |
|
1650 |
|
1649 |
-- |
1651 |
-- |
Lines 1654-1659
DROP TABLE IF EXISTS `old_issues`;
Link Here
|
1654 |
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned |
1656 |
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned |
1655 |
`issue_id` int(11) NOT NULL, -- primary key for issues table |
1657 |
`issue_id` int(11) NOT NULL, -- primary key for issues table |
1656 |
`borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
1658 |
`borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
|
|
1659 |
`issuer` int(11) default NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item |
1657 |
`itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out |
1660 |
`itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out |
1658 |
`date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) |
1661 |
`date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) |
1659 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
1662 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
Lines 1676-1682
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r
Link Here
|
1676 |
CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) |
1679 |
CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) |
1677 |
ON DELETE SET NULL ON UPDATE SET NULL, |
1680 |
ON DELETE SET NULL ON UPDATE SET NULL, |
1678 |
CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) |
1681 |
CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) |
1679 |
ON DELETE SET NULL ON UPDATE SET NULL |
1682 |
ON DELETE SET NULL ON UPDATE SET NULL, |
|
|
1683 |
CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) |
1684 |
ON DELETE SET NULL ON UPDATE CASCADE |
1680 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1685 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1681 |
|
1686 |
|
1682 |
-- |
1687 |
-- |
1683 |
- |
|
|