 CREATE INDEX transfers_timestamp_idx ON transfers (timestamp);
 CREATE INDEX transfers_tipper_idx ON transfers (tipper);
 CREATE INDEX transfers_tippee_idx ON transfers (tippee);
-
-
--- paydays -- payday events, stats about them
-CREATE TABLE paydays
-( id                    serial                      PRIMARY KEY
-, ts_start              timestamp with time zone    NOT NULL DEFAULT CURRENT_TIMESTAMP
-, ts_end                timestamp with time zone    UNIQUE NOT NULL DEFAULT '1970-01-01T00:00:00+00'::timestamptz
-, volume                numeric(35,2)               NOT NULL DEFAULT 0.00
-, nusers                bigint                      NOT NULL DEFAULT 0
-, stage                 integer                     DEFAULT 0
- );
 
 
 -- https://github.com/gratipay/gratipay.com/pull/3282

    ('unresolved', 'pending-payout', 'resolved');


-- https://github.com/gratipay/gratipay.com/pull/3730
BEGIN;

    ALTER TABLE transfers ADD COLUMN payday integer DEFAULT NULL
        REFERENCES paydays ON UPDATE RESTRICT ON DELETE RESTRICT;

END;


-- https://github.com/gratipay/gratipay.com/pull/3733
BEGIN;


    ('tip', 'take', 'final-gift', 'take-over', 'one-off');


-- paydays -- payday events, stats about them
CREATE TABLE paydays
( id                    serial                      PRIMARY KEY
, ts_start              timestamp with time zone    NOT NULL DEFAULT CURRENT_TIMESTAMP
, ts_end                timestamp with time zone    UNIQUE NOT NULL DEFAULT '1970-01-01T00:00:00+00'::timestamptz
, volume                numeric(35,2)               NOT NULL DEFAULT 0.00
, nusers                bigint                      NOT NULL DEFAULT 0
, stage                 integer                     DEFAULT 0
 );


-- transfers -- balance transfers from one user to another
CREATE TABLE transfers
( id                    serial                      PRIMARY KEY
