diff --git a/node/src/bin/manager.rs b/node/src/bin/manager.rs index 81c794485d4..e1606b1864d 100644 --- a/node/src/bin/manager.rs +++ b/node/src/bin/manager.rs @@ -309,29 +309,6 @@ pub enum Command { #[clap(subcommand)] Database(DatabaseCommand), - /// Delete a deployment and all it's indexed data - /// - /// The deployment can be specified as either a subgraph name, an IPFS - /// hash `Qm..`, or the database namespace `sgdNNN`. Since the same IPFS - /// hash can be deployed in multiple shards, it is possible to specify - /// the shard by adding `:shard` to the IPFS hash. - Drop { - /// The deployment identifier - deployment: DeploymentSearch, - /// Search only for current version - #[clap(long, short)] - current: bool, - /// Search only for pending versions - #[clap(long, short)] - pending: bool, - /// Search only for used (current and pending) versions - #[clap(long, short)] - used: bool, - /// Skip confirmation prompt - #[clap(long, short)] - force: bool, - }, - /// Deploy a subgraph Deploy { name: DeploymentSearch, @@ -1699,29 +1676,6 @@ async fn main() -> anyhow::Result<()> { } } } - Drop { - deployment, - current, - pending, - used, - force, - } => { - let sender = ctx.notification_sender(); - let (store, primary_pool) = ctx.store_and_primary(); - let subgraph_store = store.subgraph_store(); - - commands::drop::run( - primary_pool, - subgraph_store, - sender, - deployment, - current, - pending, - used, - force, - ) - .await - } Deploy { deployment, diff --git a/node/src/manager/commands/drop.rs b/node/src/manager/commands/drop.rs deleted file mode 100644 index b0d10d0ff63..00000000000 --- a/node/src/manager/commands/drop.rs +++ /dev/null @@ -1,68 +0,0 @@ -use crate::manager::{ - deployment::{Deployment, DeploymentSearch}, - display::List, - prompt::prompt_for_confirmation, -}; -use graph::anyhow::{self, bail}; -use graph_store_postgres::{ConnectionPool, NotificationSender, SubgraphStore}; -use std::sync::Arc; - -/// Finds, unassigns, record and remove matching deployments. -/// -/// Asks for confirmation before removing any data. This is a convenience -/// function that to call a series of other graphman commands. -pub async fn run( - primary_pool: ConnectionPool, - subgraph_store: Arc, - sender: Arc, - search_term: DeploymentSearch, - current: bool, - pending: bool, - used: bool, - skip_confirmation: bool, -) -> anyhow::Result<()> { - // call `graphman info` to find matching deployments - let deployments = search_term.find(primary_pool.clone(), current, pending, used)?; - if deployments.is_empty() { - bail!("Found no deployment for search_term: {search_term}") - } else { - print_deployments(&deployments); - if !skip_confirmation && !prompt_for_confirmation("\nContinue?")? { - println!("Execution aborted by user"); - return Ok(()); - } - } - // call `graphman unassign` to stop any active deployments - crate::manager::commands::assign::unassign(primary_pool, &sender, &search_term).await?; - - // call `graphman remove` to unregister the subgraph's name - for deployment in &deployments { - crate::manager::commands::remove::run(subgraph_store.clone(), &deployment.name)?; - } - - // call `graphman unused record` to register those deployments unused - crate::manager::commands::unused_deployments::record(subgraph_store.clone())?; - - // call `graphman unused remove` to remove each deployment's data - for deployment in &deployments { - crate::manager::commands::unused_deployments::remove( - subgraph_store.clone(), - 1_000_000, - Some(&deployment.deployment), - None, - )?; - } - Ok(()) -} - -fn print_deployments(deployments: &[Deployment]) { - let mut list = List::new(vec!["name", "deployment"]); - println!("Found {} deployment(s) to remove:", deployments.len()); - for deployment in deployments { - list.append(vec![ - deployment.name.to_string(), - deployment.deployment.to_string(), - ]); - } - list.render(); -} diff --git a/node/src/manager/commands/mod.rs b/node/src/manager/commands/mod.rs index cb81a19ecb3..42e45605ebd 100644 --- a/node/src/manager/commands/mod.rs +++ b/node/src/manager/commands/mod.rs @@ -7,7 +7,6 @@ pub mod create; pub mod database; pub mod deploy; pub mod deployment; -pub mod drop; pub mod index; pub mod listen; pub mod provider_checks;