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