MCPcopy Create free account
hub / github.com/dolthub/doltgresql / validateSchemaForCreate

Function validateSchemaForCreate

core/rootvalue.go:141–152  ·  view source on GitHub ↗

validateSchemaForCreate returns an error if a schema with the name given cannot be created

(existingSchemas []schema.DatabaseSchema, dbSchema schema.DatabaseSchema)

Source from the content-addressed store, hash-verified

139
140// validateSchemaForCreate returns an error if a schema with the name given cannot be created
141func validateSchemaForCreate(existingSchemas []schema.DatabaseSchema, dbSchema schema.DatabaseSchema) error {
142 if dbSchema.Name == "" {
143 return errors.New("Schema name cannot be empty")
144 }
145
146 for _, s := range existingSchemas {
147 if strings.EqualFold(s.Name, dbSchema.Name) {
148 return errors.Errorf("A schema with the name %s already exists", dbSchema.Name)
149 }
150 }
151 return nil
152}
153
154func (root *RootValue) TableListHash() uint64 {
155 return 0

Callers 1

CreateDatabaseSchemaMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected