(diff *schema.MetadataDiff)
| 359 | } |
| 360 | |
| 361 | func buildDropObjectMaps(diff *schema.MetadataDiff) *metadataObjectMaps { |
| 362 | maps := newMetadataObjectMaps() |
| 363 | for _, tableDiff := range diff.TableChanges { |
| 364 | if tableDiff.Action == schema.MetadataDiffActionDrop { |
| 365 | maps.tables[getMigrationObjectID(tableDiff.SchemaName, tableDiff.TableName)] = tableDiff |
| 366 | } |
| 367 | } |
| 368 | for _, viewDiff := range diff.ViewChanges { |
| 369 | if viewDiff.Action == schema.MetadataDiffActionDrop || alteredViewDependsOnTableDDL(viewDiff, diff) { |
| 370 | maps.views[getMigrationObjectID(viewDiff.SchemaName, viewDiff.ViewName)] = viewDiff |
| 371 | } |
| 372 | } |
| 373 | for _, materializedViewDiff := range diff.MaterializedViewChanges { |
| 374 | if materializedViewDiff.Action == schema.MetadataDiffActionDrop || materializedViewDiff.Action == schema.MetadataDiffActionAlter { |
| 375 | maps.materializedViews[getMigrationObjectID(materializedViewDiff.SchemaName, materializedViewDiff.MaterializedViewName)] = materializedViewDiff |
| 376 | } |
| 377 | } |
| 378 | for _, functionDiff := range diff.FunctionChanges { |
| 379 | if functionDiff.Action == schema.MetadataDiffActionDrop { |
| 380 | maps.functions[getMigrationObjectID(functionDiff.SchemaName, functionDiff.FunctionName)] = functionDiff |
| 381 | } |
| 382 | } |
| 383 | for _, procedureDiff := range diff.ProcedureChanges { |
| 384 | if procedureDiff.Action == schema.MetadataDiffActionDrop { |
| 385 | maps.procedures[getMigrationObjectID(procedureDiff.SchemaName, procedureDiff.ProcedureName)] = procedureDiff |
| 386 | } |
| 387 | } |
| 388 | return maps |
| 389 | } |
| 390 | |
| 391 | func alteredViewDependsOnTableDDL(viewDiff *schema.ViewDiff, diff *schema.MetadataDiff) bool { |
| 392 | if viewDiff.Action != schema.MetadataDiffActionAlter { |
no test coverage detected