ALTER TABLE repos ADD COLUMN user_id INTEGER;

UPDATE repos SET user_id = (
  SELECT id FROM users WHERE admin = true ORDER BY id LIMIT 1
);

ALTER TABLE repos
ALTER COLUMN user_id SET NOT NULL;

ALTER TABLE repos
ADD CONSTRAINT user_id_fk
FOREIGN KEY(user_id) REFERENCES users(id)
ON DELETE CASCADE
ON UPDATE CASCADE;
