 ( id                    serial          PRIMARY KEY
 , platform              text            NOT NULL
 , user_id               text            NOT NULL
+, participant           text            NOT NULL REFERENCES participants ON UPDATE CASCADE ON DELETE RESTRICT
 , is_locked             boolean         NOT NULL DEFAULT FALSE
-, participant           text            NOT NULL REFERENCES participants ON UPDATE CASCADE ON DELETE RESTRICT
 , access_token          text            DEFAULT NULL
 , refresh_token         text            DEFAULT NULL
 , expires               timestamptz     DEFAULT NULL

                                                ON UPDATE CASCADE
                                                ON DELETE RESTRICT
, CONSTRAINT no_team_recursion CHECK (team != member)
 );

CREATE VIEW current_takes AS

  ON transfers
  USING btree
  (tipper, tippee, timestamp DESC);
