-- 000040_security_prefs.sql — 个人安全策略:新设备登录通知开关。 -- 登录成功后 identity 服务发布 security.login_detected 事件,通知 worker 依据 -- 本表开关决定是否落站内信(默认开启,收件人 = 账号本人)。 CREATE TABLE IF NOT EXISTS gateway.portal_security_prefs ( portal_user_id uuid PRIMARY KEY REFERENCES gateway.portal_users(id) ON DELETE CASCADE, login_notify boolean NOT NULL DEFAULT true, updated_at timestamptz NOT NULL DEFAULT clock_timestamp() );