-- MySQL schema for the database

-- User table

CREATE TABLE user (
    user_id INT PRIMARY KEY AUTO_INCREMENT,
    user_email VARCHAR(50) NOT NULL,
    user_password VARCHAR(255) NOT NULL,
    user_names VARCHAR(50) NOT NULL,
    user_surnames VARCHAR(50) NOT NULL,

    user_creation DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    user_last_login DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);


-- This sentence creates the first user, the super admin, with a password "123456789"
-- TODO: Change the password for the super admin to a secure one
insert into user (user_email, user_password, user_names, user_surnames) 
values ('administracion@eegsac.com', '$argon2id$v=19$m=65536,t=4,p=1$TE1wdklnMEpsMDAveWhzYw$nsKg2fALcXZ8AquM7jPGBUjM3Dyg5tgbDATKMeKPtfQ', 'Administracion', 'EEGSAC');
