SET default_storage_engine = InnoDB;
DROP DATABASE IF EXISTS `inventory`;
CREATE DATABASE IF NOT EXISTS `inventory`
    CHARACTER SET utf8mb4
    COLLATE utf8mb4_unicode_ci;

DROP USER IF EXISTS 'inventory';
CREATE USER 'inventory'@'localhost' IDENTIFIED BY 'irCd3CH9MELH7Pa9KEHWxoz4S987iGWCP+JQZe4w+3s=';
GRANT ALL PRIVILEGES ON inventory.* TO 'inventory'@'localhost';

USE `inventory`;

CREATE TABLE IF NOT EXISTS computers (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    brand VARCHAR(255) NOT NULL,
    model VARCHAR(255) NOT NULL,
    status VARCHAR(255) NOT NULL,
    dateOfEntry DATE NOT NULL DEFAULT CURRENT_DATE,
    state VARCHAR(255) NOT NULL,
    PRIMARY KEY (id)
) ENGINE=InnoDB;

INSERT INTO computers (brand, model, status, state) VALUES
    ('Dell', 'Latitude 7400', 'Available', 'RAS'),
    ('Dell', 'Latitude 7400', 'Available', 'RAS'),
    ('Dell', 'Latitude 7400', 'Available', 'RAS');


CREATE TABLE IF NOT EXISTS users (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    PRIMARY KEY (id)
) ENGINE=InnoDB;