feat: Consolidate user, role, and theme settings tables into a single migration file
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user