MCPcopy Create free account
hub / github.com/dosco/graphjin / TestComputeDiff_DropTable_Destructive

Function TestComputeDiff_DropTable_Destructive

core/schema_diff_test.go:355–389  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

353}
354
355func TestComputeDiff_DropTable_Destructive(t *testing.T) {
356 current := &sdata.DBInfo{
357 Type: "postgres",
358 Tables: []sdata.DBTable{
359 {
360 Name: "old_table",
361 Columns: []sdata.DBColumn{
362 {Name: "id", Type: "bigint", PrimaryKey: true},
363 },
364 },
365 },
366 }
367
368 expected := &sdata.DBInfo{
369 Type: "postgres",
370 Tables: []sdata.DBTable{},
371 }
372
373 // With destructive flag
374 ops := computeDiff(current, expected, DiffOptions{Destructive: true})
375
376 found := false
377 for _, op := range ops {
378 if op.Type == "drop_table" && op.Table == "old_table" {
379 found = true
380 if !op.Danger {
381 t.Error("drop_table operation should be marked as dangerous")
382 }
383 }
384 }
385
386 if !found {
387 t.Error("expected drop_table operation when destructive is true")
388 }
389}
390
391func TestPostgresDialect_MapType(t *testing.T) {
392 d := &postgresDialect{}

Callers

nothing calls this directly

Calls 2

computeDiffFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected