From 75ed54ba7fc8c50aa6a489e319a00ddde7af6f1d Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 24 Sep 2026 14:26:18 +1000 Subject: [PATCH] fix(legacyimport): imported captures take the new event_type column's default --- internal/infrastructure/legacyimport/load.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/infrastructure/legacyimport/load.go b/internal/infrastructure/legacyimport/load.go index 4d5096601..127e367ac 100644 --- a/internal/infrastructure/legacyimport/load.go +++ b/internal/infrastructure/legacyimport/load.go @@ -23,6 +23,13 @@ var droppedColumns = map[string]bool{ "playbook_dispatches.id": true, } +// newColumns are target columns added after the legacy stores, with no +// legacy value to carry. Imported rows take the column default: an imported +// capture has no event type, so it stays unidentified and never dispatches. +var newColumns = map[string]bool{ + "captures.event_type": true, +} + // targetKeys override a table's legacy key where the target has no column // for it. var targetKeys = map[string][]string{ @@ -171,6 +178,7 @@ func plan(ctx context.Context, tx pgx.Tx, t legacyread.Table, problems *refusal) problems.add("%s: no target table", t.Name) } targetNames := map[string]bool{} + cols = slices.DeleteFunc(cols, func(c column) bool { return newColumns[t.Name+"."+c.name] }) for i := range cols { targetNames[cols[i].name] = true cols[i].source = slices.Index(t.Columns, cols[i].name)