38527-vm/db/migrations/20260215_granular_roles_and_themes.sql
Flatlogic Bot 1e73419ffb v6
2026-02-15 11:24:55 +00:00

13 lines
498 B
SQL

-- Migration: Add channel permissions and user theme preference
CREATE TABLE IF NOT EXISTS channel_permissions (
channel_id INT NOT NULL,
role_id INT NOT NULL,
allow_permissions INT DEFAULT 0,
deny_permissions INT DEFAULT 0,
PRIMARY KEY (channel_id, role_id),
FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE,
FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE
);
ALTER TABLE users ADD COLUMN IF NOT EXISTS theme VARCHAR(20) DEFAULT 'dark';