Files
inbox-negotiator/supabase/migrations/20250607000500_add_ai_parsing_columns.sql
Francisco Pessano 7a8790d564 Add AI parsing capabilities for debt information and update database schema
- Implemented AI-powered parsing for debt emails using Google's Gemini model.
- Enhanced Postmark webhook to extract debt details including amount, vendor, description, due date, and legitimacy.
- Updated database schema to include new columns for AI-extracted data.
- Added environment variable requirements and updated package dependencies.
- Created migration script for new database columns and indexes.
2025-06-07 00:59:09 -03:00

17 lines
854 B
SQL

-- Add new columns for AI-enhanced debt parsing
-- Migration for improved debt information storage
-- Add new columns to debts table
ALTER TABLE debts ADD COLUMN IF NOT EXISTS description text;
ALTER TABLE debts ADD COLUMN IF NOT EXISTS due_date timestamptz;
ALTER TABLE debts ADD COLUMN IF NOT EXISTS metadata jsonb DEFAULT '{}'::jsonb;
-- Create indexes for new columns
CREATE INDEX IF NOT EXISTS idx_debts_due_date ON debts(due_date);
CREATE INDEX IF NOT EXISTS idx_debts_metadata ON debts USING gin(metadata);
-- Add comment for documentation
COMMENT ON COLUMN debts.description IS 'AI-extracted description of what the debt is for';
COMMENT ON COLUMN debts.due_date IS 'Due date extracted from the email, if mentioned';
COMMENT ON COLUMN debts.metadata IS 'Additional metadata including isDebtCollection flag and other AI-extracted information';