-- Run this once in phpMyAdmin. Adds Google OAuth support for FamPay
-- Verify (Sign in with Google, instead of manual UPI/Gmail/App Password).

-- Where to store the app's Google OAuth credentials (set via Website
-- Manage / Site Settings admin page).
ALTER TABLE `site_settings`
  ADD COLUMN `google_client_id` VARCHAR(255) DEFAULT NULL,
  ADD COLUMN `google_client_secret` VARCHAR(255) DEFAULT NULL,
  ADD COLUMN `google_redirect_uri` VARCHAR(255) DEFAULT NULL;

-- Where each merchant's Google tokens are stored once they connect.
-- app_password is kept for any merchants who already connected the old
-- manual way; new connects populate refresh_token/access_token instead.
ALTER TABLE `fampay_tokens`
  ADD COLUMN `refresh_token` TEXT DEFAULT NULL AFTER `app_password`,
  ADD COLUMN `access_token` TEXT DEFAULT NULL AFTER `refresh_token`,
  ADD COLUMN `token_expiry` INT DEFAULT NULL AFTER `access_token`;
