-- Create system_config table to track system-wide settings CREATE TABLE system_config ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), key VARCHAR(255) NOT NULL UNIQUE, value TEXT NOT NULL, description TEXT, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW() ); -- Create index on key for faster lookups CREATE INDEX idx_system_config_key ON system_config(key); -- Create trigger to automatically update updated_at CREATE TRIGGER update_system_config_updated_at BEFORE UPDATE ON system_config FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); -- Insert initial system configuration INSERT INTO system_config (key, value, description) VALUES ('admin_initialized', 'false', 'Whether the first admin user has been initialized');