Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphman: Add graphman create #2419

Merged
merged 1 commit into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions node/src/bin/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ pub enum Command {
/// The name of the subgraph to remove
name: String,
},
/// Create a subgraph name
Create {
/// The name of the subgraph to create
name: String,
},
/// Assign or reassign a deployment
Reassign {
/// The id of the deployment to reassign
Expand Down Expand Up @@ -453,6 +458,7 @@ async fn main() {
}
}
Remove { name } => commands::remove::run(ctx.subgraph_store(), name),
Create { name } => commands::create::run(ctx.subgraph_store(), name),
Unassign { id, shard } => commands::assign::unassign(ctx.subgraph_store(), id, shard),
Reassign { id, node, shard } => {
commands::assign::reassign(ctx.subgraph_store(), id, node, shard)
Expand Down
14 changes: 14 additions & 0 deletions node/src/manager/commands/create.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::sync::Arc;

use graph::prelude::{anyhow, Error, SubgraphName, SubgraphStore as _};
use graph_store_postgres::SubgraphStore;

pub fn run(store: Arc<SubgraphStore>, name: String) -> Result<(), Error> {
let name = SubgraphName::new(name.clone())
.map_err(|()| anyhow!("illegal subgraph name `{}`", name))?;

println!("creating subgraph {}", name);
store.create_subgraph(name)?;

Ok(())
}
1 change: 1 addition & 0 deletions node/src/manager/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod assign;
pub mod config;
pub mod copy;
pub mod create;
pub mod info;
pub mod listen;
pub mod query;
Expand Down