(schemaName string)
| 302 | } |
| 303 | |
| 304 | func (d *DatabaseMetadata) DropSchema(schemaName string) error { |
| 305 | // Check if schema exists |
| 306 | if d.GetSchemaMetadata(schemaName) == nil { |
| 307 | return errors.Errorf("schema %q does not exist in database %q", schemaName, d.proto.GetName()) |
| 308 | } |
| 309 | |
| 310 | // Remove from internal map |
| 311 | schemaID := normalizeNameByCaseSensitivity(schemaName, d.isObjectCaseSensitive) |
| 312 | delete(d.internal, schemaID) |
| 313 | |
| 314 | // Remove from proto's schema list |
| 315 | newSchemas := make([]*storepb.SchemaMetadata, 0, len(d.proto.Schemas)-1) |
| 316 | for _, schema := range d.proto.Schemas { |
| 317 | if d.isObjectCaseSensitive { |
| 318 | if schema.Name != schemaName { |
| 319 | newSchemas = append(newSchemas, schema) |
| 320 | } |
| 321 | } else { |
| 322 | if !strings.EqualFold(schema.Name, schemaName) { |
| 323 | newSchemas = append(newSchemas, schema) |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | d.proto.Schemas = newSchemas |
| 328 | |
| 329 | return nil |
| 330 | } |
| 331 | |
| 332 | // GetTable gets the schema by name. |
| 333 | func (s *SchemaMetadata) GetTable(name string) *TableMetadata { |
nothing calls this directly
no test coverage detected