Files
pagodera/lib/db/migrations/020_purchase_intentions_custom_offer.sql
Evandro Fonseca Junior d8e7d5d7e6 feat: enhance purchase intentions with chat integration and offer tracking
- Added MongoDB chat/message integration for seller responses
- Improved seller response validation and default messaging
- Integrated automatic chat creation/update when responding to intentions
- Added highest custom offer fields to listing queries and models
- Enhanced listing data with top offer information for buyers
2025-11-08 11:51:21 -03:00

18 lines
643 B
SQL

-- Migration 020: Custom offer fields for purchase intentions
-- Criado em: 2025-02-07
ALTER TABLE purchase_intentions
ADD COLUMN IF NOT EXISTS custom_offer_amount NUMERIC(12, 2),
ADD COLUMN IF NOT EXISTS custom_offer_currency VARCHAR(20),
ADD COLUMN IF NOT EXISTS custom_offer_created_at TIMESTAMP WITHOUT TIME ZONE;
-- Atualizar registros existentes para evitar valores inconsistentes
UPDATE purchase_intentions
SET custom_offer_amount = NULL,
custom_offer_currency = NULL,
custom_offer_created_at = NULL
WHERE custom_offer_amount IS NOT NULL
OR custom_offer_currency IS NOT NULL
OR custom_offer_created_at IS NOT NULL;