CREATE TABLE IF NOT EXISTS users
(
    user_no BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    email VARCHAR(100) NOT NULL,
    group_name VARCHAR(255) NOT NULL default "Keyboard"
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS roles
(
    role_no INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
    role_name varchar(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS user_roles
(
    user_no BIGINT NOT NULL,
    role_no INT NOT NULL,
    FOREIGN KEY (user_no) REFERENCES users (user_no),
    FOREIGN KEY (role_no) REFERENCES roles (role_no)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS push_devices (
    id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    fcm_token VARCHAR(255)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS user_extra_data
(
    id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    storage_path VARCHAR(255)
)