(out *strings.Builder, schemaDiff *schema.SchemaDiff)
| 1461 | } |
| 1462 | |
| 1463 | func writeSchemaDiff(out *strings.Builder, schemaDiff *schema.SchemaDiff) error { |
| 1464 | switch schemaDiff.Action { |
| 1465 | case schema.MetadataDiffActionCreate: |
| 1466 | if skipPostgresSchemaDDL(schemaDiff.SchemaName) { |
| 1467 | return nil |
| 1468 | } |
| 1469 | return writeSchema(out, schemaDiff.NewSchema) |
| 1470 | case schema.MetadataDiffActionDrop: |
| 1471 | if skipPostgresSchemaDDL(schemaDiff.SchemaName) { |
| 1472 | return nil |
| 1473 | } |
| 1474 | if err := writeDropSchemaObjects(out, schemaDiff.SchemaName, schemaDiff.OldSchema); err != nil { |
| 1475 | return err |
| 1476 | } |
| 1477 | _, err := fmt.Fprintf(out, "DROP SCHEMA IF EXISTS \"%s\";\n\n", schemaDiff.SchemaName) |
| 1478 | return err |
| 1479 | default: |
| 1480 | return nil |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | func skipPostgresSchemaDDL(schemaName string) bool { |
| 1485 | return schemaName == "pg_catalog" || schemaName == "public" |
no test coverage detected