feat: Consolidate user, role, and theme settings tables into a single migration file
Some checks failed
Run Tests / e2e tests (push) Failing after 3s
Run Tests / lint tests (push) Failing after 1m30s
Run Tests / unit tests (push) Failing after 1m32s

This commit is contained in:
2025-10-27 14:56:37 +01:00
parent e37488bcf6
commit b1d50a56e0
6 changed files with 38 additions and 55 deletions

View File

@@ -158,4 +158,32 @@ ALTER TABLE capex
ALTER TABLE opex
DROP COLUMN IF EXISTS currency_code;
-- Role-based access control tables
CREATE TABLE IF NOT EXISTS roles (
id SERIAL PRIMARY KEY,
name VARCHAR(255) UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
hashed_password VARCHAR(255) NOT NULL,
role_id INTEGER NOT NULL REFERENCES roles (id) ON DELETE RESTRICT
);
CREATE INDEX IF NOT EXISTS ix_users_username ON users (username);
CREATE INDEX IF NOT EXISTS ix_users_email ON users (email);
-- Theme settings configuration table
CREATE TABLE IF NOT EXISTS theme_settings (
id SERIAL PRIMARY KEY,
theme_name VARCHAR(255) UNIQUE NOT NULL,
primary_color VARCHAR(7) NOT NULL,
secondary_color VARCHAR(7) NOT NULL,
accent_color VARCHAR(7) NOT NULL,
background_color VARCHAR(7) NOT NULL,
text_color VARCHAR(7) NOT NULL
);
COMMIT;