🌐 Cloud-Native Architecture: - Firebase Functions deployment (no Docker) - Supabase database (replacing local PostgreSQL) - Google Cloud Storage integration - Document AI + Agentic RAG processing pipeline - Claude-3.5-Sonnet LLM integration ✅ Full BPCP CIM Review Template (7 sections): - Deal Overview - Business Description - Market & Industry Analysis - Financial Summary (with historical financials table) - Management Team Overview - Preliminary Investment Thesis - Key Questions & Next Steps 🔧 Cloud Migration Improvements: - PostgreSQL → Supabase migration complete - Local storage → Google Cloud Storage - Docker deployment → Firebase Functions - Schema mapping fixes (camelCase/snake_case) - Enhanced error handling and logging - Vector database with fallback mechanisms 📄 Complete End-to-End Cloud Workflow: 1. Upload PDF → Document AI extraction 2. Agentic RAG processing → Structured CIM data 3. Store in Supabase → Vector embeddings 4. Auto-generate PDF → Full BPCP template 5. Download complete CIM review 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
const { createClient } = require('@supabase/supabase-js');
|
|
require('dotenv').config();
|
|
|
|
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_KEY);
|
|
|
|
async function fixTableSchema() {
|
|
console.log('🔧 Checking current document_chunks table schema...');
|
|
|
|
// First, let's see the current table structure
|
|
const { data: columns, error } = await supabase
|
|
.from('information_schema.columns')
|
|
.select('column_name, data_type')
|
|
.eq('table_name', 'document_chunks')
|
|
.eq('table_schema', 'public');
|
|
|
|
if (error) {
|
|
console.log('❌ Could not fetch table schema:', error.message);
|
|
return;
|
|
}
|
|
|
|
console.log('📋 Current columns:', columns.map(c => `${c.column_name} (${c.data_type})`));
|
|
|
|
// Check if chunk_index exists (might be named differently)
|
|
const hasChunkIndex = columns.some(c => c.column_name === 'chunk_index');
|
|
const hasChunkIndexCamel = columns.some(c => c.column_name === 'chunkIndex');
|
|
|
|
console.log('Has chunk_index:', hasChunkIndex);
|
|
console.log('Has chunkIndex:', hasChunkIndexCamel);
|
|
|
|
if (!hasChunkIndex && !hasChunkIndexCamel) {
|
|
console.log('⚠️ Missing chunk index column. This explains the error.');
|
|
console.log('');
|
|
console.log('🛠️ To fix this, run the following SQL in Supabase:');
|
|
console.log('ALTER TABLE document_chunks ADD COLUMN chunk_index INTEGER;');
|
|
} else {
|
|
console.log('✅ Chunk index column exists');
|
|
}
|
|
}
|
|
|
|
fixTableSchema(); |