CREATE TABLE IF NOT EXISTS user_notification (
    "user" UUID PRIMARY KEY REFERENCES "user"(id),
    email_enabled BOOLEAN NOT NULL DEFAULT TRUE,
    in_app_enabled BOOLEAN NOT NULL DEFAULT TRUE,
    push_enabled BOOLEAN NOT NULL DEFAULT FALSE,
    digest_mode TEXT NOT NULL DEFAULT 'daily',
    dnd_enabled BOOLEAN NOT NULL DEFAULT FALSE,
    dnd_start_minute INTEGER,
    dnd_end_minute INTEGER,
    marketing_enabled BOOLEAN NOT NULL DEFAULT TRUE,
    security_enabled BOOLEAN NOT NULL DEFAULT TRUE,
    product_enabled BOOLEAN NOT NULL DEFAULT TRUE,
    push_subscription_endpoint TEXT,
    push_subscription_keys_p256dh TEXT,
    push_subscription_keys_auth TEXT,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
