feat(db): migracion 004 — columna import_key + indice para imports idempotentes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
-- 004_import_key.sql
|
||||
-- Clave de importación determinística para imports idempotentes de contactos.
|
||||
--
|
||||
-- import_key se deriva de la identidad estable del contacto (teléfonos
|
||||
-- normalizados > emails > nombre normalizado) con la función del registry
|
||||
-- contact_import_key_py_core. Permite re-importar el mismo .vcf de Google (u
|
||||
-- otra fuente) y matchear la fila existente sin depender del UID opaco goog-<hash>
|
||||
-- ni del FN, que el pipeline de import transforma. El backfill de las filas
|
||||
-- existentes lo hace el tool de importación (no esta migración: requiere Python).
|
||||
--
|
||||
-- Aditiva e idempotente: ADD COLUMN IF NOT EXISTS + CREATE INDEX IF NOT EXISTS.
|
||||
ALTER TABLE contacts ADD COLUMN IF NOT EXISTS import_key TEXT;
|
||||
CREATE INDEX IF NOT EXISTS idx_contacts_import_key ON contacts (import_key);
|
||||
Reference in New Issue
Block a user