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

Function tidbDropDatabase

backend/plugin/schema/tidb/walk_through.go:221–236  ·  view source on GitHub ↗
(d *model.DatabaseMetadata, node *tidbast.DropDatabaseStmt)

Source from the content-addressed store, hash-verified

219}
220
221func tidbDropDatabase(d *model.DatabaseMetadata, node *tidbast.DropDatabaseStmt) *storepb.Advice {
222 if !isCurrentDatabase(d, node.Name.O) {
223 content := fmt.Sprintf("Database `%s` is not the current database `%s`", node.Name.O, d.GetProto().Name)
224 return &storepb.Advice{
225 Status: storepb.Advice_WARNING,
226 Code: code.NotCurrentDatabase.Int32(),
227 Title: content,
228 Content: content,
229 StartPosition: &storepb.Position{Line: 0},
230 }
231 }
232
233 // Note: In walk-through, we don't need to actually delete the database metadata
234 // The check is sufficient for validation
235 return nil
236}
237
238func tidbAlterDatabase(d *model.DatabaseMetadata, node *tidbast.AlterDatabaseStmt) *storepb.Advice {
239 if !node.AlterDefaultDatabase && !isCurrentDatabase(d, node.Name.O) {

Callers 1

changeStateTiDBFunction · 0.85

Calls 3

isCurrentDatabaseFunction · 0.70
GetProtoMethod · 0.45
Int32Method · 0.45

Tested by

no test coverage detected