perf(go): trim frame id from location history

This commit is contained in:
lingniu
2026-07-03 08:56:04 +08:00
parent c916120ea2
commit c2e4c2b955
5 changed files with 16 additions and 13 deletions

View File

@@ -23,9 +23,9 @@ func TestSchemaStatementsCreateCoreStables(t *testing.T) {
t.Fatalf("raw schema should not create duplicate fields_json column:\n%s", statements)
}
locationStable := between(statements, "CREATE STABLE IF NOT EXISTS vehicle_locations", "}")
for _, field := range []string{"vehicle_key", "phone", "device_id"} {
for _, field := range []string{"frame_id", "vehicle_key", "phone", "device_id"} {
if strings.Contains(locationStable, field) {
t.Fatalf("location stable should only keep protocol/vin identity tags, found %s:\n%s", field, locationStable)
t.Fatalf("location stable should only keep core location columns and protocol/vin tags, found %s:\n%s", field, locationStable)
}
}
}
@@ -78,6 +78,10 @@ func TestWriterAppendsRawAndLocationOnly(t *testing.T) {
t.Fatalf("location child should not carry raw identity fallback tag %s: %s", field, locationChild)
}
}
locationInsert := findSQL(exec.calls, "INSERT INTO loc_")
if strings.Contains(locationInsert, "frame_id") || strings.Contains(locationInsert, "go_") {
t.Fatalf("location insert should not duplicate raw frame id: %s", locationInsert)
}
}
func TestWriterNormalizesPhoneTagAndRefreshesExistingChildTags(t *testing.T) {