|
Lines 1662-1667
DROP TABLE IF EXISTS `issues`;
Link Here
|
| 1662 |
CREATE TABLE `issues` ( -- information related to check outs or issues |
1662 |
CREATE TABLE `issues` ( -- information related to check outs or issues |
| 1663 |
`issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table |
1663 |
`issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table |
| 1664 |
`borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
1664 |
`borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
|
|
1665 |
`issuer` int(11), -- foreign key, linking this to the borrowers table for the user who checked out this item |
| 1665 |
`itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out |
1666 |
`itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out |
| 1666 |
`date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) |
1667 |
`date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) |
| 1667 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
1668 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
|
Lines 1683-1689
CREATE TABLE `issues` ( -- information related to check outs or issues
Link Here
|
| 1683 |
KEY `branchcode_idx` (`branchcode`), |
1684 |
KEY `branchcode_idx` (`branchcode`), |
| 1684 |
KEY `bordate` (`borrowernumber`,`timestamp`), |
1685 |
KEY `bordate` (`borrowernumber`,`timestamp`), |
| 1685 |
CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
1686 |
CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
| 1686 |
CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE |
1687 |
CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE, |
|
|
1688 |
CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE |
| 1687 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1689 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 1688 |
|
1690 |
|
| 1689 |
-- |
1691 |
-- |
|
Lines 1694-1699
DROP TABLE IF EXISTS `old_issues`;
Link Here
|
| 1694 |
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned |
1696 |
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned |
| 1695 |
`issue_id` int(11) NOT NULL, -- primary key for issues table |
1697 |
`issue_id` int(11) NOT NULL, -- primary key for issues table |
| 1696 |
`borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
1698 |
`borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to |
|
|
1699 |
`issuer` int(11) default NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item |
| 1697 |
`itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out |
1700 |
`itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out |
| 1698 |
`date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) |
1701 |
`date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) |
| 1699 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
1702 |
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out |
|
Lines 1716-1722
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r
Link Here
|
| 1716 |
CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) |
1719 |
CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) |
| 1717 |
ON DELETE SET NULL ON UPDATE SET NULL, |
1720 |
ON DELETE SET NULL ON UPDATE SET NULL, |
| 1718 |
CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) |
1721 |
CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) |
| 1719 |
ON DELETE SET NULL ON UPDATE SET NULL |
1722 |
ON DELETE SET NULL ON UPDATE SET NULL, |
|
|
1723 |
CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) |
| 1724 |
ON DELETE SET NULL ON UPDATE CASCADE |
| 1720 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
1725 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 1721 |
|
1726 |
|
| 1722 |
-- |
1727 |
-- |
| 1723 |
- |
|
|