add auto load .env

This commit is contained in:
2026-09-10 13:53:20 +02:00
parent d6cb4078bc
commit 9016fb7baf
13 changed files with 532 additions and 28 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
-- Active: 1788811699247@@127.0.0.1@3306@my_database
-- 1. Groups (roles) — create first since users references it
CREATE TABLE groups (
-- Active: 1783331450344@@127.0.0.1@3306@cmms
-- 1. group_infos (roles) — create first since users references it
CREATE TABLE group_infos (
group_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL UNIQUE,
description VARCHAR(255)
@@ -13,7 +13,7 @@ CREATE TABLE users (
email VARCHAR(255) NOT NULL UNIQUE,
group_id INT NULL, -- nullable if a user can exist with no group yet
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE SET NULL
FOREIGN KEY (group_id) REFERENCES group_infos(group_id) ON DELETE SET NULL
);
-- 3. Resources / modules
@@ -34,7 +34,7 @@ CREATE TABLE group_permissions (
resource_id INT NOT NULL,
action_id INT NOT NULL,
PRIMARY KEY (group_id, resource_id, action_id),
FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE CASCADE,
FOREIGN KEY (group_id) REFERENCES group_infos(group_id) ON DELETE CASCADE,
FOREIGN KEY (resource_id) REFERENCES resources(resource_id) ON DELETE CASCADE,
FOREIGN KEY (action_id) REFERENCES actions(action_id) ON DELETE CASCADE
);