(d *model.DatabaseMetadata, node *tidbast.DropDatabaseStmt)
| 219 | } |
| 220 | |
| 221 | func 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 | |
| 238 | func tidbAlterDatabase(d *model.DatabaseMetadata, node *tidbast.AlterDatabaseStmt) *storepb.Advice { |
| 239 | if !node.AlterDefaultDatabase && !isCurrentDatabase(d, node.Name.O) { |
no test coverage detected