MCPcopy Create free account
hub / github.com/bytebase/bytebase / writeTableDiff

Function writeTableDiff

backend/plugin/schema/pg/metadata_migration.go:932–944  ·  view source on GitHub ↗
(out *strings.Builder, tableDiff *schema.TableDiff)

Source from the content-addressed store, hash-verified

930}
931
932func writeTableDiff(out *strings.Builder, tableDiff *schema.TableDiff) error {
933 switch tableDiff.Action {
934 case schema.MetadataDiffActionCreate:
935 return writeTableForMetadataMigration(out, tableDiff.SchemaName, tableDiff.NewTable)
936 case schema.MetadataDiffActionDrop:
937 _, err := fmt.Fprintf(out, "DROP TABLE \"%s\".\"%s\";\n\n", tableDiff.SchemaName, tableDiff.TableName)
938 return err
939 case schema.MetadataDiffActionAlter:
940 return writeAlterTableDiff(out, tableDiff)
941 default:
942 return nil
943 }
944}
945
946func writeTableForMetadataMigration(out *strings.Builder, schemaName string, table *storepb.TableMetadata) error {
947 if err := writeCreateTableForMetadataMigration(out, schemaName, table); err != nil {

Callers 2

writeCreateTablesFunction · 0.85

Calls 2

writeAlterTableDiffFunction · 0.85

Tested by

no test coverage detected