refactor(go): simplify daily mileage table key
This commit is contained in:
@@ -121,8 +121,13 @@ func TestWriterEnsuresSchemaAndUpsertsDailyMileage(t *testing.T) {
|
||||
if !strings.Contains(exec.calls[0].query, "CREATE TABLE IF NOT EXISTS vehicle_daily_mileage") {
|
||||
t.Fatalf("unexpected schema sql: %s", exec.calls[0].query)
|
||||
}
|
||||
if strings.Contains(exec.calls[0].query, "vehicle_key") {
|
||||
t.Fatalf("schema should not include vehicle_key: %s", exec.calls[0].query)
|
||||
for _, column := range []string{"vehicle_key", "id BIGINT", "AUTO_INCREMENT", "created_at"} {
|
||||
if strings.Contains(exec.calls[0].query, column) {
|
||||
t.Fatalf("schema should not include %s: %s", column, exec.calls[0].query)
|
||||
}
|
||||
}
|
||||
if !strings.Contains(exec.calls[0].query, "PRIMARY KEY (vin, stat_date, protocol)") {
|
||||
t.Fatalf("daily mileage table should key by vin/stat_date/protocol: %s", exec.calls[0].query)
|
||||
}
|
||||
if len(exec.calls) != 2 {
|
||||
t.Fatalf("exec calls = %d", len(exec.calls))
|
||||
|
||||
Reference in New Issue
Block a user