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