feat(milvus): add database and collection deletion

This commit is contained in:
onenewcode authored and GitHub committed 2026-08-20 18:25:12 +08:00
1 parent db8f262c14
commit 439f2c2617
14 files changed
+309 -12

No files matched your search

+2
View File
@@ -776,6 +776,8 @@ async fn main() {
.route("/mongo/list-databases", post(routes::mongo::list_databases))
.route("/mongo/list-collections", post(routes::mongo::list_collections))
.route("/mongo/vector-collection-detail", post(routes::mongo::vector_collection_detail))
.route("/vector/drop-database", post(routes::mongo::vector_drop_database))
.route("/vector/drop-collection", post(routes::mongo::vector_drop_collection))
.route("/mongo/create-database", post(routes::mongo::create_database))
.route("/mongo/drop-database", post(routes::mongo::drop_database))
.route("/mongo/drop-collection", post(routes::mongo::drop_collection))
+28
View File
@@ -367,6 +367,34 @@ pub async fn vector_collection_detail(
Ok(Json(result))
}
pub async fn vector_drop_database(
State(state): State<Arc<WebState>>,
headers: HeaderMap,
Json(req): Json<MongoCollectionRequest>,
) -> Result<Json<serde_json::Value>, AppError> {
super::mcp_policy::ensure_dangerous_write(&state, &headers, &req.connection_id, &req.database, "Drop database")
.await?;
ensure_writable(&state.app, &req.connection_id, "Drop database").await?;
dbx_core::schema::drop_vector_database_core(&state.app, &req.connection_id, &req.database)
.await
.map_err(AppError::from)?;
Ok(Json(serde_json::json!({ "ok": true })))
}
pub async fn vector_drop_collection(
State(state): State<Arc<WebState>>,
headers: HeaderMap,
Json(req): Json<MongoCollectionNameRequest>,
) -> Result<Json<serde_json::Value>, AppError> {
super::mcp_policy::ensure_dangerous_write(&state, &headers, &req.connection_id, &req.database, "Drop collection")
.await?;
ensure_writable(&state.app, &req.connection_id, "Drop collection").await?;
dbx_core::schema::drop_vector_collection_core(&state.app, &req.connection_id, &req.database, &req.collection)
.await
.map_err(AppError::from)?;
Ok(Json(serde_json::json!({ "ok": true })))
}
pub async fn create_database(
State(state): State<Arc<WebState>>,
Json(req): Json<MongoCollectionRequest>,