(t *testing.T)
| 273 | } |
| 274 | |
| 275 | func 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 | |
| 311 | func TestComputeDiff_DropColumn_Destructive(t *testing.T) { |
| 312 | current := &sdata.DBInfo{ |
nothing calls this directly
no test coverage detected