name: doccorretor-google-drive-migration
description: Migrate documents from Google Drive to DocCorretor — OAuth setup, rclone config, and migration strategies
tags:
- google-drive
- doccorretor
- migration
- oauth
DocCorretor Google Drive Migration
Context
DocCorretor (documentos.rochasalesseguros.com.br) needs to migrate documents from Google Drive. The Drive folder contains documents organized by year > month > client name (uppercase).
⚠️ CRITICAL — Supabase: DocCorretor uses dauftiqcvgaydddoxqhh (SAME Supabase as ComercialRS, but with COMPLETELY DIFFERENT tables). CommercialRS tables: crm_leads, tasks, sales, etc. DocCorretor tables: clients, client_folders, documents, client_upload_links. NEVER confuse them.
Tables:
- -
clients— 584 clients - -
client_folders— 539 folders (NOTE: notfolders, it'sclient_folders) - -
documents— 4773 documents - -
client_upload_links— 17 upload links - - OAuth Client ID:
1058938147936-giqs5jjl9rtt8gs1o493p3pv15k527bp.apps.googleusercontent.com - - OAuth Client Secret:
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(from VPS:/var/www/documentos2/app/.env) - - Drive Folder ID:
1zVhApvpFM937qxsvsz37WCcUD-7f2zUP - - Google Redirect URI:
https://documentos.rochasalesseguros.com.br/api/public/gmail-oauth-callback - - Google Drive API requires OAuth — API key alone (even with folder shared) returns 403
- - gdown can download files but cannot list directories
- - Browser tool (playwright) needs display server — fails in headless VPS environment
- - OAuth refresh token never expires unless revoked
Baseline scan (01/Jul/2026): 584 clients, 4773 documents, 48 clients without folders. See NEURONS/DocCorretor/DOCUMENTATION/DRIVE-MIGRATION-BASELINE.md
Database access: Supabase Cloud API is unreliable (quota exceeded). Use direct Docker query:
`bash
ssh root@31.97.243.106 "docker exec -i deploy-vps-db-1 psql -U supabase_admin -d postgres -c \"SELECT ... FROM clients ...\""
`
Key Files
Known Limitations
Migration Options
1. Automatic: Script parses filenames, matches to existing clients, creates folder structure
2. Review mode: List all files first, present plan for user approval before importing
3. Manual selective: User picks which folders/files to import one by one