MCPcopy Index your code
hub / github.com/dosco/graphjin / TestComputeDiff_DropColumn_NotDestructive

Function TestComputeDiff_DropColumn_NotDestructive

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

Source from the content-addressed store, hash-verified

273}
274
275func TestComputeDiff_DropColumn_NotDestructive(t *testing.T) {
276 current := &sdata.DBInfo{
277 Type: "postgres",
278 Tables: []sdata.DBTable{
279 {
280 Name: "users",
281 Columns: []sdata.DBColumn{
282 {Name: "id", Type: "bigint", PrimaryKey: true},
283 {Name: "old_column", Type: "text"},
284 },
285 },
286 },
287 }
288
289 expected := &sdata.DBInfo{
290 Type: "postgres",
291 Tables: []sdata.DBTable{
292 {
293 Name: "users",
294 Columns: []sdata.DBColumn{
295 {Name: "id", Type: "bigint", PrimaryKey: true},
296 },
297 },
298 },
299 }
300
301 // Without destructive flag
302 ops := computeDiff(current, expected, DiffOptions{Destructive: false})
303
304 for _, op := range ops {
305 if op.Type == "drop_column" {
306 t.Error("should not have drop_column operation when destructive is false")
307 }
308 }
309}
310
311func TestComputeDiff_DropColumn_Destructive(t *testing.T) {
312 current := &sdata.DBInfo{

Callers

nothing calls this directly

Calls 2

computeDiffFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected