CREATE TABLE IF NOT EXISTS metricas_invalidaciones (
  contribuyente_id uuid NOT NULL,
  anio             smallint NOT NULL,
  mes              smallint NOT NULL,
  reason           text,
  marcado_at       timestamptz DEFAULT now(),
  PRIMARY KEY (contribuyente_id, anio, mes)
);

INSERT INTO tenant_migrations (scope, version, name)
VALUES ('vertical-contable', 17, '017_metricas_invalidaciones')
ON CONFLICT (scope, version) DO NOTHING;
