fix(db): corregir numeric overflow en score_engagement
La columna numeric(6,4) solo admite hasta 99.9999. En videos virales donde likes > vistas el trigger calcular_score_engagement produce un valor >100 y Postgres lanza overflow. Se amplía a numeric(10,4). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
database/migrations/09_fix_score_engagement.sql
Normal file
13
database/migrations/09_fix_score_engagement.sql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
-- ============================================================
|
||||||
|
-- MIGRACIÓN 09 — Fix numeric overflow en score_engagement
|
||||||
|
-- Ejecutar en Supabase SQL Editor después de la migración 08
|
||||||
|
-- ============================================================
|
||||||
|
-- PROBLEMA: numeric(6,4) solo permite hasta 99.9999.
|
||||||
|
-- Si likes > vistas (videos virales), la fórmula
|
||||||
|
-- (likes + compartidos*3) / vistas * 100 puede superar 100
|
||||||
|
-- y Postgres lanza "numeric field overflow".
|
||||||
|
-- SOLUCIÓN: ampliar a numeric(10,4) → soporta hasta 999999.9999
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
alter table guiones
|
||||||
|
alter column score_engagement type numeric(10,4);
|
||||||
Reference in New Issue
Block a user