ALTER TABLE users
  ADD COLUMN IF NOT EXISTS auth_token_version integer NOT NULL DEFAULT 0;

ALTER TABLE password_reset_tokens
  ADD COLUMN IF NOT EXISTS attempts integer NOT NULL DEFAULT 0;

ALTER TABLE password_reset_tokens
  ADD COLUMN IF NOT EXISTS is_exchange_token boolean NOT NULL DEFAULT false;

UPDATE password_reset_tokens
SET attempts = 0
WHERE attempts IS NULL;

UPDATE password_reset_tokens
SET is_exchange_token = false
WHERE is_exchange_token IS NULL;
