CREATE TABLE audit_logs ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID NOT NULL, action TEXT NOT NULL, resource_type TEXT NOT NULL, resource_id UUID, metadata JSONB DEFAULT '{}', ip_address INET, user_agent TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc', now()) );