-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Device Redirect fix and database sql file
- Loading branch information
Showing
2 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
-- MySQL Workbench Forward Engineering | ||
|
||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; | ||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; | ||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; | ||
|
||
-- ----------------------------------------------------- | ||
-- Schema mydb | ||
-- ----------------------------------------------------- | ||
-- ----------------------------------------------------- | ||
-- Schema ad_15a989204c2ff8a | ||
-- ----------------------------------------------------- | ||
|
||
-- ----------------------------------------------------- | ||
-- Schema ad_15a989204c2ff8a | ||
-- ----------------------------------------------------- | ||
CREATE SCHEMA IF NOT EXISTS `ad_15a989204c2ff8a` DEFAULT CHARACTER SET utf8 ; | ||
USE `ad_15a989204c2ff8a` ; | ||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`fingerprint` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`fingerprint` ( | ||
`Finger_ID` INT(11) NOT NULL COMMENT 'SEE ME DEVICE SECURITY', | ||
PRIMARY KEY (`Finger_ID`)) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`location` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`location` ( | ||
`Location_ID` INT(11) NOT NULL COMMENT 'Identification key for a location.', | ||
`Name` VARCHAR(45) NOT NULL COMMENT 'Name of the location, not necessarily unique.', | ||
`Address` VARCHAR(45) NOT NULL COMMENT 'Address for shipping. Just the number and street name, other fields will go elsewhere.', | ||
`Town` VARCHAR(45) NOT NULL COMMENT 'Town of location.', | ||
`State` VARCHAR(45) NOT NULL COMMENT 'State of location.', | ||
`Zip_Code` VARCHAR(45) NOT NULL COMMENT 'Zip Code for shipping. Data type is VARCHAR to support leading zeros.', | ||
`Employee_Flag` INT(11) NULL DEFAULT NULL, | ||
`Latitude` VARCHAR(45) NULL DEFAULT NULL, | ||
`Longitude` VARCHAR(45) NULL DEFAULT NULL, | ||
PRIMARY KEY (`Location_ID`)) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`employee` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`employee` ( | ||
`Employee_ID` INT(9) NOT NULL COMMENT 'Employee ID number.', | ||
`Location_ID` INT(11) NOT NULL COMMENT 'Where the employee is registered to work at.', | ||
`Name` VARCHAR(45) NOT NULL COMMENT 'Actual name, might not be unique', | ||
`Phone_Number` VARCHAR(45) NULL DEFAULT NULL COMMENT 'Contact information.', | ||
`Email` VARCHAR(45) NULL DEFAULT NULL, | ||
`Img_Index` INT(9) NULL DEFAULT NULL, | ||
`Notification_Preference` INT(11) NULL DEFAULT NULL COMMENT 'This indicates what notification preferences are being used at the moment.\n\nIt will be a number 0-7, which are all (in binary) 3 bit numbers, thus spanning 3 different notification options.\n\nAdam will later indicate which bit corresponds to which notification type.', | ||
PRIMARY KEY (`Employee_ID`), | ||
INDEX `LOCATION_ID_idx` (`Location_ID` ASC), | ||
CONSTRAINT `Employee_Location_ID` | ||
FOREIGN KEY (`Location_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`location` (`Location_ID`) | ||
ON UPDATE CASCADE) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`admin` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`admin` ( | ||
`Admin_ID` INT(9) NOT NULL COMMENT 'The ID of an administrator. This should be identical to the ID of its corresponding employee, therefore making this a subset of that table.', | ||
`Finger_ID` INT(11) NULL DEFAULT NULL COMMENT 'The ID of an admin\'s fingerprint. This has to do with the Device Security\'s team.', | ||
`Finger_Registered_Flag` INT(11) NULL DEFAULT '0' COMMENT 'This field will indicate whether a fingerprint is registered for an employee. Value\'s will be 1/0 for true/false.', | ||
`Password` VARCHAR(45) NOT NULL DEFAULT 'pass1234', | ||
`Finger_ID_2` INT(11) NULL DEFAULT NULL, | ||
`Finger_ID_3` INT(11) NULL DEFAULT NULL, | ||
`Password_Flag` INT(1) NULL DEFAULT '0', | ||
`Pincode` VARCHAR(45) NULL DEFAULT NULL, | ||
PRIMARY KEY (`Admin_ID`), | ||
INDEX `Admin_Finger_ID_2_idx` (`Finger_ID_2` ASC), | ||
INDEX `Admin_Finger_ID_idx` (`Finger_ID` ASC), | ||
INDEX `Admin_Finger_ID_3_idx` (`Finger_ID_3` ASC), | ||
CONSTRAINT `Admin_Finger_ID_2` | ||
FOREIGN KEY (`Finger_ID_2`) | ||
REFERENCES `ad_15a989204c2ff8a`.`fingerprint` (`Finger_ID`) | ||
ON DELETE SET NULL | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Admin_Finger_ID_3` | ||
FOREIGN KEY (`Finger_ID_3`) | ||
REFERENCES `ad_15a989204c2ff8a`.`fingerprint` (`Finger_ID`) | ||
ON DELETE SET NULL | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Admin_Employee_ID` | ||
FOREIGN KEY (`Admin_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`employee` (`Employee_ID`) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Admin_Finger_ID` | ||
FOREIGN KEY (`Finger_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`fingerprint` (`Finger_ID`) | ||
ON DELETE SET NULL | ||
ON UPDATE CASCADE) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`ticket` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`ticket` ( | ||
`Ticket_ID` INT(11) NOT NULL COMMENT 'Identification piece of a ticket.', | ||
`Requestor` INT(11) NOT NULL COMMENT 'Whoever initiated the request. Will use their employee ID.', | ||
`Request_Date` BIGINT(20) NULL DEFAULT NULL, | ||
`Location` INT(11) NOT NULL COMMENT 'Where the device is begin requested to be shipped to.', | ||
`Device_ID` INT(11) NOT NULL COMMENT 'The ID of the device corresponding to this ticket.', | ||
`Status` VARCHAR(45) NOT NULL COMMENT 'Current status of the ticket.', | ||
`Status_Date_Fields` BIGINT(20) NULL DEFAULT NULL, | ||
`Return_Date` VARCHAR(10) NULL DEFAULT NULL, | ||
PRIMARY KEY (`Ticket_ID`), | ||
INDEX `Requestor_idx` (`Requestor` ASC), | ||
INDEX `Ticket_Location_idx` (`Location` ASC), | ||
INDEX `Ticket_Device_ID_idx` (`Device_ID` ASC), | ||
CONSTRAINT `Ticket_Device_ID` | ||
FOREIGN KEY (`Device_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`devices` (`Device_ID`) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Ticket_Location` | ||
FOREIGN KEY (`Location`) | ||
REFERENCES `ad_15a989204c2ff8a`.`location` (`Location_ID`) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Ticket_Requestor` | ||
FOREIGN KEY (`Requestor`) | ||
REFERENCES `ad_15a989204c2ff8a`.`employee` (`Employee_ID`) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`devices` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`devices` ( | ||
`Device_ID` INT(11) NOT NULL COMMENT 'How devices will be individually identified. ', | ||
`Device_Name` VARCHAR(45) NOT NULL COMMENT 'The actual display name of the device, given from Synchrony Financial.\n', | ||
`Locker_Position` VARCHAR(45) NULL DEFAULT NULL, | ||
`Manufacturer` VARCHAR(45) NOT NULL COMMENT 'The company that produced this product.', | ||
`Hardware` VARCHAR(45) NOT NULL COMMENT 'Indicates general hardware. IE smartphone, tablet, etc.', | ||
`Model` VARCHAR(45) NOT NULL COMMENT 'What model the device is, specifically. IE iPad Air 2, iPhone SE, etc.', | ||
`Operating_System` VARCHAR(45) NULL DEFAULT NULL, | ||
`Device_Description` VARCHAR(200) NULL DEFAULT NULL COMMENT 'A creative description for the device.\n\nLater this should be NN but we haven\'t had the chance to determine all descriptions we want.', | ||
`Admin_Comments` VARCHAR(256) NULL DEFAULT NULL, | ||
`MAC_Address` VARCHAR(45) NULL DEFAULT NULL COMMENT 'MAC Address of device.', | ||
`Serial_Num` VARCHAR(45) NULL DEFAULT NULL COMMENT 'The serial number on the device. ', | ||
`Ticket_ID` INT(11) NULL DEFAULT NULL COMMENT 'The ticket this device is currently ordered on. Can be null if not ordered out. Foreign key to the ticket table’s primary key.', | ||
`Renter` INT(11) NULL DEFAULT NULL COMMENT 'Employee ID of whoever is renting out the device currently – can be null if nobody is renting it.', | ||
`Location` INT(11) NOT NULL DEFAULT '1' COMMENT 'Storage if not rented, if rented the location COULD be different from the location listed under an employee’s records.\n\nIf missing, select location 5 - MISSING.', | ||
`Status` VARCHAR(45) NOT NULL DEFAULT 'Available' COMMENT 'Describes the status of device. This may be available, rented, shipped, etc.', | ||
`Borrow_Date` VARCHAR(10) NULL DEFAULT NULL COMMENT 'The date this device was borrowed.', | ||
`Return_Date` VARCHAR(10) NULL DEFAULT NULL COMMENT 'The date the user says they will return the device by.', | ||
`Creation_Date` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The date that the device was added to the database for the first time.', | ||
`NFC_ID` VARCHAR(32) NULL DEFAULT NULL COMMENT 'NFC ID used by Device Security Team for scanning device into locker.', | ||
PRIMARY KEY (`Device_ID`), | ||
INDEX `Device_Renter_idx` (`Renter` ASC), | ||
INDEX `Device_Location_idx` (`Location` ASC), | ||
INDEX `Device_Ticket_ID_idx` (`Ticket_ID` ASC), | ||
INDEX `Device_Item_Num_idx` (`Ticket_ID` ASC), | ||
CONSTRAINT `Device_Renter` | ||
FOREIGN KEY (`Renter`) | ||
REFERENCES `ad_15a989204c2ff8a`.`employee` (`Employee_ID`) | ||
ON UPDATE CASCADE, | ||
CONSTRAINT `Device_Ticket_ID` | ||
FOREIGN KEY (`Ticket_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`ticket` (`Ticket_ID`) | ||
ON DELETE SET NULL | ||
ON UPDATE CASCADE) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`log` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`log` ( | ||
`log_ID` INT(11) NOT NULL AUTO_INCREMENT, | ||
`Employee_ID` INT(11) NOT NULL COMMENT 'Opens the door', | ||
`AccessTime` DATETIME NOT NULL, | ||
PRIMARY KEY (`log_ID`), | ||
INDEX `Employee_ID_idx` (`Employee_ID` ASC), | ||
CONSTRAINT `Employee_ID` | ||
FOREIGN KEY (`Employee_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`employee` (`Employee_ID`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION) | ||
ENGINE = InnoDB | ||
AUTO_INCREMENT = 62 | ||
DEFAULT CHARACTER SET = utf8 | ||
COMMENT = 'Track door openings'; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`sessions` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`sessions` ( | ||
`SessionID` INT(11) NOT NULL AUTO_INCREMENT, | ||
`PersonID` INT(11) NULL DEFAULT NULL, | ||
`AccessTime` DATETIME NULL DEFAULT NULL, | ||
`NFCID` VARCHAR(16) NULL DEFAULT NULL, | ||
PRIMARY KEY (`SessionID`), | ||
INDEX `Sessions_PersonID_idx` (`PersonID` ASC), | ||
CONSTRAINT `Sessions_PersonID` | ||
FOREIGN KEY (`PersonID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`admin` (`Admin_ID`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION) | ||
ENGINE = InnoDB | ||
AUTO_INCREMENT = 112 | ||
DEFAULT CHARACTER SET = utf8 | ||
COMMENT = 'For Device Security Team\nTracks movement of devices in/out of door'; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `ad_15a989204c2ff8a`.`waitlist` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `ad_15a989204c2ff8a`.`waitlist` ( | ||
`Waitlist_ID` INT(11) NOT NULL COMMENT 'The ID of a wait list item.', | ||
`Ticket_ID` INT(11) NOT NULL, | ||
PRIMARY KEY (`Waitlist_ID`), | ||
INDEX `TICKET_ID_idx` (`Ticket_ID` ASC), | ||
CONSTRAINT `Waitlist_Ticket_ID` | ||
FOREIGN KEY (`Ticket_ID`) | ||
REFERENCES `ad_15a989204c2ff8a`.`ticket` (`Ticket_ID`) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8; | ||
|
||
|
||
SET SQL_MODE=@OLD_SQL_MODE; | ||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; | ||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |