--- Create DBs
CREATE DATABASE IF NOT EXISTS calcms;
CREATE DATABASE IF NOT EXISTS calcms_test;

--- Create admin user
CREATE USER IF NOT EXISTS 'calcms_admin'@'%' IDENTIFIED BY 'caladmin000';
GRANT ALL PRIVILEGES ON calcms.* TO 'calcms_admin'@'%';
GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_admin'@'%';
--- Create write user
CREATE USER IF NOT EXISTS 'calcms_write'@'%' IDENTIFIED BY 'calwrite000';
GRANT SELECT, INSERT, UPDATE, DELETE ON calcms.* TO 'calcms_write'@'%';
GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_write'@'%';
--- Create read user
CREATE USER IF NOT EXISTS 'calcms_read'@'%' IDENTIFIED BY 'calread000';
GRANT SELECT ON calcms.* TO 'calcms_read'@'%';
GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_read'@'%';

