veza/veza-backend-api/migrations/118_user_preferences.sql

18 lines
827 B
MySQL
Raw Normal View History

-- v0.801: User preferences table with appearance fields (contrast, density, accent_hue, font_size)
CREATE TABLE IF NOT EXISTS user_preferences (
user_id UUID PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
theme VARCHAR(20) NOT NULL DEFAULT 'light',
language VARCHAR(10) NOT NULL DEFAULT 'en',
timezone VARCHAR(50) NOT NULL DEFAULT 'UTC',
notifications JSONB NOT NULL DEFAULT '{}',
privacy JSONB NOT NULL DEFAULT '{}',
audio JSONB NOT NULL DEFAULT '{}',
contrast VARCHAR(10) NOT NULL DEFAULT 'normal',
density VARCHAR(12) NOT NULL DEFAULT 'comfortable',
accent_hue INT NOT NULL DEFAULT 220,
font_size INT NOT NULL DEFAULT 16,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_user_preferences_user_id ON user_preferences(user_id);