 , verification_start    timestamp with time zone    NOT NULL
                                                       DEFAULT CURRENT_TIMESTAMP
 , verification_end      timestamp with time zone
-, participant           text                        NOT NULL
-                                                      REFERENCES participants
-                                                      ON UPDATE CASCADE
+, participant_id        bigint                      NOT NULL
+                                                      REFERENCES participants(id)
+                                                      ON UPDATE RESTRICT
                                                       ON DELETE RESTRICT
 
 , UNIQUE (address, verified) -- A verified email address can't be linked to multiple

                             -- be linked to multiple participants. We implement this
                             -- by using NULL instead of FALSE for the unverified
                             -- state, hence the check constraint on verified.
, UNIQUE (participant, address)
, CONSTRAINT emails_nonce_key UNIQUE (nonce)
 );


END;


-- https://github.com/gratipay/gratipay.com/pull/4027
CREATE TABLE countries -- http://www.iso.org/iso/country_codes
( id    bigserial   primary key
