CREATE TABLE system (
    key string primary key,
    value string
);

CREATE TABLE users (
    uuid string primary key,
    username string,
    password string
);

CREATE TABLE roles (
    uuid string primary key,
    descriptor string
);

CREATE TABLE role_permissions (
    uuid string primary key,
    role string,
    system_permission string
);

CREATE TABLE user_roles (
    uuid string primary key,
    role string,
    user string
);

CREATE TABLE saves (
    uuid string primary key,
    name string,
    user string,
    path string
);

INSERT INTO system (key, value) VALUES ('db.version', '1');
INSERT INTO users (uuid, username) VALUES ('4b5b9489-973c-44e7-bae0-5ab23b56abe7', 'root');
INSERT INTO roles (uuid, descriptor) VALUES ('4b5b9489-973c-44e7-bae0-5ab23b56abe7', 'root');
INSERT INTO role_permissions (uuid, role, system_permission) VALUES ('4b5b9489-973c-44e7-bae0-5ab23b56abe7', '4b5b9489-973c-44e7-bae0-5ab23b56abe7', '*.*');
INSERT INTO user_roles (uuid, role, user) VALUES ('4b5b9489-973c-44e7-bae0-5ab23b56abe7', '4b5b9489-973c-44e7-bae0-5ab23b56abe7', '4b5b9489-973c-44e7-bae0-5ab23b56abe7');
