begin;

create table if not exists dashboards (
    dash_id integer unique not null,
    dash_text text not null,
    dash_description text,
    group_id integer not null,
    active integer not null default 1,
    date_create TEXT NOT NULL DEFAULT (datetime('now')),
    id integer primary key autoincrement
);

create table if not exists groups (
    group_id text unique not null,
    group_text text not null,
    group_description text,
    active integer not null default 1,
    date_create TEXT NOT NULL DEFAULT (datetime('now')),
    id integer primary key autoincrement
);

create table if not exists roles (
    role_id integer unique not null,
    role_text text not null,
    role_description text,
    active integer not null default 1,
    date_create TEXT NOT NULL DEFAULT (datetime('now')),
    id integer primary key autoincrement
);

create table if not exists permissions (
    role_id integer unique not null,
    dash_id integer unique not null,
    active integer not null default 1,
    date_create TEXT NOT NULL DEFAULT (datetime('now')),
    id integer primary key autoincrement
);

INSERT INTO schema_version (version) VALUES ('20251130_191100_add_table_dashboards');

COMMIT;