Skip to content

Commit 2562cbc

Browse files
committed
store: Asyncify Layout::create_relational_schema
1 parent f306b75 commit 2562cbc

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

store/postgres/src/deployment_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl DeploymentStore {
226226
schema,
227227
entities_with_causality_region.into_iter().collect(),
228228
index_def,
229-
)?;
229+
).await?;
230230
// See if we are grafting and check that the graft is permissible
231231
if let Some(base) = graft_base {
232232
let errors = layout.can_copy_from(&base);

store/postgres/src/relational.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl Layout {
375375
}
376376
}
377377

378-
pub fn create_relational_schema(
378+
pub async fn create_relational_schema(
379379
conn: &mut PgConnection,
380380
site: Arc<Site>,
381381
schema: &InputSchema,

store/test-store/tests/postgres/relational.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fn insert_pets(conn: &mut PgConnection, layout: &Layout) {
487487
insert_pet(conn, layout, &*CAT_TYPE, "garfield", "Garfield", 0, 1);
488488
}
489489

490-
fn create_schema(conn: &mut PgConnection) -> Layout {
490+
async fn create_schema(conn: &mut PgConnection) -> Layout {
491491
let schema = InputSchema::parse_latest(THINGS_GQL, THINGS_SUBGRAPH_ID.clone()).unwrap();
492492
let site = make_dummy_site(
493493
THINGS_SUBGRAPH_ID.clone(),
@@ -498,6 +498,7 @@ fn create_schema(conn: &mut PgConnection) -> Layout {
498498
conn.batch_execute(&query).unwrap();
499499

500500
Layout::create_relational_schema(conn, Arc::new(site), &schema, BTreeSet::new(), None)
501+
.await
501502
.expect("Failed to create relational schema")
502503
}
503504

@@ -549,7 +550,7 @@ where
549550
remove_schema(conn);
550551

551552
// Create the database schema
552-
let layout = create_schema(conn);
553+
let layout = create_schema(conn).await;
553554

554555
// Run test
555556
test(conn, &layout).await;

store/test-store/tests/postgres/relational_bytes.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn insert_thing(conn: &mut PgConnection, layout: &Layout, id: &str, name: &str,
142142
);
143143
}
144144

145-
fn create_schema(conn: &mut PgConnection) -> Layout {
145+
async fn create_schema(conn: &mut PgConnection) -> Layout {
146146
let schema = InputSchema::parse_latest(THINGS_GQL, THINGS_SUBGRAPH_ID.clone()).unwrap();
147147

148148
let query = format!("create schema {}", NAMESPACE.as_str());
@@ -154,6 +154,7 @@ fn create_schema(conn: &mut PgConnection) -> Layout {
154154
NETWORK_NAME.to_string(),
155155
);
156156
Layout::create_relational_schema(conn, Arc::new(site), &schema, BTreeSet::new(), None)
157+
.await
157158
.expect("Failed to create relational schema")
158159
}
159160

@@ -198,7 +199,7 @@ where
198199
remove_test_data(conn);
199200

200201
// Seed database with test data
201-
let layout = create_schema(conn);
202+
let layout = create_schema(conn).await;
202203

203204
// Run test
204205
test(conn, &layout).await;

0 commit comments

Comments
 (0)