CREATE TABLE customer_wechat_identity ( app_id text NOT NULL, open_id text NOT NULL, phone_digest char(64) NOT NULL REFERENCES customer_phone_credential(phone_digest), created_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY(app_id,open_id), UNIQUE(app_id,phone_digest) );