CREATE DATABASE TagData;
CREATE TABLE `TagData`.`tags` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `tagName` VARCHAR(128) NULL,
  `dateAdded` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `units` VARCHAR(16) NULL,
  `deleted` INT NULL DEFAULT 0,
  PRIMARY KEY (`id`));

CREATE TABLE `TagData`.`values` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `tagID` INT NULL,
  `val` FLOAT NULL,
  `dateAdded` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`));

CREATE USER 'website'@'localhost' IDENTIFIED BY 'henrypump';
GRANT ALL ON *.* TO 'website'@'localhost';
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'henrypump';
GRANT ALL ON *.* to 'admin'@'localhost';
CREATE USER 'admin'@'%' IDENTIFIED BY 'henrypump';
GRANT ALL ON *.* to 'admin'@'%';
FLUSH PRIVILEGES;