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

Function writeSchema

backend/plugin/schema/pg/get_database_definition.go:3562–3581  ·  view source on GitHub ↗
(out io.Writer, schema *storepb.SchemaMetadata)

Source from the content-addressed store, hash-verified

3560}
3561
3562func writeSchema(out io.Writer, schema *storepb.SchemaMetadata) error {
3563 if schema.Name == "public" {
3564 return nil
3565 }
3566
3567 if _, err := io.WriteString(out, `CREATE SCHEMA IF NOT EXISTS "`); err != nil {
3568 return err
3569 }
3570
3571 if _, err := io.WriteString(out, schema.Name); err != nil {
3572 return err
3573 }
3574
3575 if _, err := io.WriteString(out, `";`); err != nil {
3576 return err
3577 }
3578
3579 _, err := io.WriteString(out, "\n\n")
3580 return err
3581}
3582
3583// writeCheckConstraintSDL writes a single check constraint SDL
3584func writeCheckConstraintSDL(out io.Writer, check *storepb.CheckConstraintMetadata) error {

Callers 5

writeSchemaDiffFunction · 0.85
GetDatabaseDefinitionFunction · 0.85
GetSchemaDefinitionFunction · 0.85
getSDLFormatFunction · 0.85
getMultiFileSchemaSDLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected