add auto load .env
This commit is contained in:
+5
-5
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user