-- Migration: Add Google Calendar Integration -- Date: 2026-02-09 -- Create google_calendar_tokens table CREATE TABLE IF NOT EXISTS google_calendar_tokens ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL UNIQUE, access_token TEXT NOT NULL, refresh_token TEXT NOT NULL, token_expiry DATETIME, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ); -- Add google_calendar_event_id column to bookings table ALTER TABLE bookings ADD COLUMN google_calendar_event_id VARCHAR(255); -- Create index for faster lookups CREATE INDEX IF NOT EXISTS idx_google_calendar_tokens_user_id ON google_calendar_tokens(user_id); CREATE INDEX IF NOT EXISTS idx_bookings_google_calendar_event_id ON bookings(google_calendar_event_id);