diff --git a/node/src/bin/manager.rs b/node/src/bin/manager.rs index afc09403357..4de4a13a8cb 100644 --- a/node/src/bin/manager.rs +++ b/node/src/bin/manager.rs @@ -359,10 +359,6 @@ pub enum Command { /// The url of the graph-node #[clap(long, short, default_value = "http://localhost:8020")] url: String, - - /// Create the subgraph name if it does not exist - #[clap(long, short)] - create: bool, }, } @@ -1637,12 +1633,11 @@ async fn main() -> anyhow::Result<()> { deployment, name, url, - create, } => { let store = ctx.store(); let subgraph_store = store.subgraph_store(); - commands::deploy::run(subgraph_store, deployment, name, url, create).await + commands::deploy::run(subgraph_store, deployment, name, url).await } } } diff --git a/node/src/manager/commands/deploy.rs b/node/src/manager/commands/deploy.rs index 5fa187615a5..34391e94544 100644 --- a/node/src/manager/commands/deploy.rs +++ b/node/src/manager/commands/deploy.rs @@ -68,7 +68,6 @@ pub async fn run( deployment: DeploymentSearch, search: DeploymentSearch, url: String, - create: bool, ) -> Result<()> { let hash = match deployment { DeploymentSearch::Hash { hash, shard: _ } => hash, @@ -80,16 +79,13 @@ pub async fn run( _ => bail!("The `name` must be a valid subgraph name"), }; - if create { - println!("Creating subgraph `{}`", name); - let subgraph_name = - SubgraphName::new(name.clone()).map_err(|_| anyhow!("Invalid subgraph name"))?; + let subgraph_name = + SubgraphName::new(name.clone()).map_err(|_| anyhow!("Invalid subgraph name"))?; - let exists = subgraph_store.subgraph_exists(&subgraph_name)?; + let exists = subgraph_store.subgraph_exists(&subgraph_name)?; - if exists { - bail!("Subgraph with name `{}` already exists", name); - } + if !exists { + println!("Creating subgraph `{}`", name); // Send the subgraph_create request send_create_request(&name, &url).await?;