/*
-- Query:
-- Date: 2020-05-14 20:59
*/
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (1,'Tested');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (2,'Sold');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (3,'Wiped');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (4,'Refunded');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (5,'Repaired');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (6,'Released to Owner');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (7,'Upgraded');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (8,'Received');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (9,'In Transit');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (10,'Picked Up');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (11,'Delivered');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (12,'Attempted');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (13,'Delayed');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (14,'Delivery Scheduled');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (15,'Note');
INSERT INTO `event_types` (`eventid`,`eventname`) VALUES (16,'Other');


-- MySQL Workbench Synchronization
-- Generated: 2020-06-02 22:54
-- Model: New Model
-- Version: 1.0
-- Project: Name of the project
-- Author: Skylar Ittner

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';

ALTER TABLE `c1machinemanager`.`components`
ADD COLUMN `manufacturer` VARCHAR(255) NULL DEFAULT NULL AFTER `price`;

CREATE TABLE IF NOT EXISTS `c1machinemanager`.`trackingcodes` (
  `trackid` INT(11) NOT NULL AUTO_INCREMENT,
  `machineid` VARCHAR(20) NOT NULL,
  `code` VARCHAR(255) NOT NULL,
  `codetype` VARCHAR(255) NULL DEFAULT NULL,
  PRIMARY KEY (`trackid`, `machineid`),
  UNIQUE INDEX `trkid_UNIQUE` (`trackid` ASC),
  INDEX `fk_trackingcodes_machines1_idx` (`machineid` ASC),
  CONSTRAINT `fk_trackingcodes_machines1`
    FOREIGN KEY (`machineid`)
    REFERENCES `c1machinemanager`.`machines` (`machineid`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

CREATE TABLE IF NOT EXISTS `c1machinemanager`.`containers` (
  `containerid` INT(11) NOT NULL AUTO_INCREMENT,
  `barcode` VARCHAR(255) NULL DEFAULT NULL,
  PRIMARY KEY (`containerid`),
  UNIQUE INDEX `containerid_UNIQUE` (`containerid` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

CREATE TABLE IF NOT EXISTS `c1machinemanager`.`container_contents` (
  `containerid` INT(11) NOT NULL,
  `machineid` VARCHAR(20) NOT NULL,
  PRIMARY KEY (`containerid`, `machineid`),
  INDEX `fk_containers_has_machines_machines1_idx` (`machineid` ASC),
  INDEX `fk_containers_has_machines_containers1_idx` (`containerid` ASC),
  CONSTRAINT `fk_containers_has_machines_containers1`
    FOREIGN KEY (`containerid`)
    REFERENCES `c1machinemanager`.`containers` (`containerid`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_containers_has_machines_machines1`
    FOREIGN KEY (`machineid`)
    REFERENCES `c1machinemanager`.`machines` (`machineid`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
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;
