Skip to content

Commit b0d2cd8

Browse files
authored
refactor: move migrations (#488)
1 parent 304cc56 commit b0d2cd8

23 files changed

+58
-58
lines changed

.github/workflows/license_headers_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ jobs:
2828
-ignore '.github/*.yml' \
2929
-ignore '.github/workflows/*.yaml' \
3030
-ignore '.github/*.yaml' \
31-
-ignore 'crates/migrations/*.sql' \
31+
-ignore 'migrations/*.sql' \
3232
.

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Install sqlx
5454
run: cargo install sqlx-cli --no-default-features --features postgres
5555
- name: Run the test sqlx migrations
56-
run: cargo sqlx migrate run --source crates/migrations
56+
run: cargo sqlx migrate run
5757
- name: Check that the sqlx prepared query metadata is up-to-date
5858
run: cargo sqlx prepare --workspace --check -- --all-targets --all-features
5959

@@ -124,7 +124,7 @@ jobs:
124124
- name: Install sqlx
125125
run: cargo install sqlx-cli --no-default-features --features postgres
126126
- name: Run the test sqlx migrations
127-
run: cargo sqlx migrate run --source crates/migrations
127+
run: cargo sqlx migrate run
128128
- name: Run tests and generate coverage report
129129
run: cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info
130130
- name: Upload coverage to Coveralls
@@ -172,6 +172,6 @@ jobs:
172172
- name: Install sqlx
173173
run: cargo install sqlx-cli --no-default-features --features postgres
174174
- name: Run the test sqlx migrations
175-
run: cargo sqlx migrate run --source crates/migrations
175+
run: cargo sqlx migrate run
176176
- name: Test documentation code snippets
177177
run: cargo test --doc --all-features --workspace

crates/common/src/cost_model.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub(crate) mod test {
250250
]
251251
}
252252

253-
#[sqlx::test(migrations = "../migrations")]
253+
#[sqlx::test(migrations = "../../migrations")]
254254
async fn success_cost_models(pool: PgPool) {
255255
let test_models = test_data();
256256
let test_deployments = test_models
@@ -312,7 +312,7 @@ pub(crate) mod test {
312312
}
313313
}
314314

315-
#[sqlx::test(migrations = "../migrations")]
315+
#[sqlx::test(migrations = "../../migrations")]
316316
async fn global_fallback_cost_models(pool: PgPool) {
317317
let test_models = test_data();
318318
let test_deployments = test_models
@@ -403,7 +403,7 @@ pub(crate) mod test {
403403
assert_eq!(missing_model.model, global_model.model);
404404
}
405405

406-
#[sqlx::test(migrations = "../migrations")]
406+
#[sqlx::test(migrations = "../../migrations")]
407407
async fn success_cost_model(pool: PgPool) {
408408
add_cost_models(&pool, to_db_models(test_data())).await;
409409

@@ -425,7 +425,7 @@ pub(crate) mod test {
425425
assert_eq!(model.model, Some("default => 0.00025;".to_string()));
426426
}
427427

428-
#[sqlx::test(migrations = "../migrations")]
428+
#[sqlx::test(migrations = "../../migrations")]
429429
async fn global_fallback_cost_model(pool: PgPool) {
430430
let test_models = test_data();
431431
let global_model = global_cost_model();

crates/common/src/tap/checks/deny_list_check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ mod tests {
224224
.await
225225
}
226226

227-
#[sqlx::test(migrations = "../migrations")]
227+
#[sqlx::test(migrations = "../../migrations")]
228228
async fn test_sender_denylist(pgpool: PgPool) {
229229
// Add the sender to the denylist
230230
sqlx::query!(
@@ -253,7 +253,7 @@ mod tests {
253253
.is_err());
254254
}
255255

256-
#[sqlx::test(migrations = "../migrations")]
256+
#[sqlx::test(migrations = "../../migrations")]
257257
async fn test_sender_denylist_updates(pgpool: PgPool) {
258258
let allocation_id = Address::from_str(ALLOCATION_ID).unwrap();
259259
let signed_receipt =

crates/common/src/tap/checks/value_check.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ mod tests {
361361

362362
use super::MinimumValue;
363363

364-
#[sqlx::test(migrations = "../migrations")]
364+
#[sqlx::test(migrations = "../../migrations")]
365365
async fn initialize_check(pgpool: PgPool) {
366366
let check = MinimumValue::new(pgpool, Duration::from_secs(0)).await;
367367
assert_eq!(check.cost_model_map.read().unwrap().len(), 0);
368368
}
369369

370-
#[sqlx::test(migrations = "../migrations")]
370+
#[sqlx::test(migrations = "../../migrations")]
371371
async fn should_initialize_check_with_models(pgpool: PgPool) {
372372
// insert 2 cost models for different deployment_id
373373
let test_models = crate::cost_model::test::test_data();
@@ -381,7 +381,7 @@ mod tests {
381381
assert!(check.global_model.read().unwrap().is_none());
382382
}
383383

384-
#[sqlx::test(migrations = "../migrations")]
384+
#[sqlx::test(migrations = "../../migrations")]
385385
async fn should_watch_model_insert(pgpool: PgPool) {
386386
let check = MinimumValue::new(pgpool.clone(), Duration::from_secs(0)).await;
387387
assert_eq!(check.cost_model_map.read().unwrap().len(), 0);
@@ -397,7 +397,7 @@ mod tests {
397397
);
398398
}
399399

400-
#[sqlx::test(migrations = "../migrations")]
400+
#[sqlx::test(migrations = "../../migrations")]
401401
async fn should_watch_model_remove(pgpool: PgPool) {
402402
// insert 2 cost models for different deployment_id
403403
let test_models = crate::cost_model::test::test_data();
@@ -417,7 +417,7 @@ mod tests {
417417
assert_eq!(check.cost_model_map.read().unwrap().len(), 0);
418418
}
419419

420-
#[sqlx::test(migrations = "../migrations")]
420+
#[sqlx::test(migrations = "../../migrations")]
421421
async fn should_start_global_model(pgpool: PgPool) {
422422
let global_model = global_cost_model();
423423
add_cost_models(&pgpool, vec![global_model.clone()]).await;
@@ -426,7 +426,7 @@ mod tests {
426426
assert!(check.global_model.read().unwrap().is_some());
427427
}
428428

429-
#[sqlx::test(migrations = "../migrations")]
429+
#[sqlx::test(migrations = "../../migrations")]
430430
async fn should_watch_global_model(pgpool: PgPool) {
431431
let check = MinimumValue::new(pgpool.clone(), Duration::from_secs(0)).await;
432432

@@ -437,7 +437,7 @@ mod tests {
437437
assert!(check.global_model.read().unwrap().is_some());
438438
}
439439

440-
#[sqlx::test(migrations = "../migrations")]
440+
#[sqlx::test(migrations = "../../migrations")]
441441
async fn should_remove_global_model(pgpool: PgPool) {
442442
let global_model = global_cost_model();
443443
add_cost_models(&pgpool, vec![global_model.clone()]).await;
@@ -457,7 +457,7 @@ mod tests {
457457

458458
const ALLOCATION_ID: Address = address!("deadbeefcafebabedeadbeefcafebabedeadbeef");
459459

460-
#[sqlx::test(migrations = "../migrations")]
460+
#[sqlx::test(migrations = "../../migrations")]
461461
async fn should_check_minimal_value(pgpool: PgPool) {
462462
// insert cost models for different deployment_id
463463
let test_models = crate::cost_model::test::test_data();
@@ -531,7 +531,7 @@ mod tests {
531531
.expect("should accept more than minimal");
532532
}
533533

534-
#[sqlx::test(migrations = "../migrations")]
534+
#[sqlx::test(migrations = "../../migrations")]
535535
async fn should_check_using_global(pgpool: PgPool) {
536536
// insert cost models for different deployment_id
537537
let test_models = crate::cost_model::test::test_data();

crates/tap-agent/src/agent/sender_account.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ pub mod tests {
11971197
(sender, handle, prefix, escrow_accounts_tx)
11981198
}
11991199

1200-
#[sqlx::test(migrations = "../migrations")]
1200+
#[sqlx::test(migrations = "../../migrations")]
12011201
async fn test_update_allocation_ids(pgpool: PgPool) {
12021202
// Start a mock graphql server using wiremock
12031203
let mock_server = MockServer::start().await;
@@ -1293,7 +1293,7 @@ pub mod tests {
12931293
handle.await.unwrap();
12941294
}
12951295

1296-
#[sqlx::test(migrations = "../migrations")]
1296+
#[sqlx::test(migrations = "../../migrations")]
12971297
async fn test_new_allocation_id(pgpool: PgPool) {
12981298
// Start a mock graphql server using wiremock
12991299
let mock_server = MockServer::start().await;
@@ -1560,7 +1560,7 @@ pub mod tests {
15601560
.as_nanos() as u64
15611561
}
15621562

1563-
#[sqlx::test(migrations = "../migrations")]
1563+
#[sqlx::test(migrations = "../../migrations")]
15641564
async fn test_update_receipt_fees_no_rav(pgpool: PgPool) {
15651565
let (sender_account, handle, prefix, _) = create_sender_account(
15661566
pgpool,
@@ -1604,7 +1604,7 @@ pub mod tests {
16041604
handle.await.unwrap();
16051605
}
16061606

1607-
#[sqlx::test(migrations = "../migrations")]
1607+
#[sqlx::test(migrations = "../../migrations")]
16081608
async fn test_update_receipt_fees_trigger_rav(pgpool: PgPool) {
16091609
let (sender_account, handle, prefix, _) = create_sender_account(
16101610
pgpool,
@@ -1665,7 +1665,7 @@ pub mod tests {
16651665
handle.await.unwrap();
16661666
}
16671667

1668-
#[sqlx::test(migrations = "../migrations")]
1668+
#[sqlx::test(migrations = "../../migrations")]
16691669
async fn test_counter_greater_limit_trigger_rav(pgpool: PgPool) {
16701670
let (sender_account, handle, prefix, _) = create_sender_account(
16711671
pgpool,
@@ -1732,7 +1732,7 @@ pub mod tests {
17321732
handle.await.unwrap();
17331733
}
17341734

1735-
#[sqlx::test(migrations = "../migrations")]
1735+
#[sqlx::test(migrations = "../../migrations")]
17361736
async fn test_remove_sender_account(pgpool: PgPool) {
17371737
let (mock_escrow_subgraph_server, _mock_ecrow_subgraph) = mock_escrow_subgraph().await;
17381738
let (sender_account, handle, prefix, _) = create_sender_account(
@@ -1769,7 +1769,7 @@ pub mod tests {
17691769
}
17701770

17711771
/// Test that the deny status is correctly loaded from the DB at the start of the actor
1772-
#[sqlx::test(migrations = "../migrations")]
1772+
#[sqlx::test(migrations = "../../migrations")]
17731773
async fn test_init_deny(pgpool: PgPool) {
17741774
sqlx::query!(
17751775
r#"
@@ -1803,7 +1803,7 @@ pub mod tests {
18031803
assert!(deny);
18041804
}
18051805

1806-
#[sqlx::test(migrations = "../migrations")]
1806+
#[sqlx::test(migrations = "../../migrations")]
18071807
async fn test_retry_unaggregated_fees(pgpool: PgPool) {
18081808
// we set to zero to block the sender, no matter the fee
18091809
let max_unaggregated_fees_per_sender: u128 = 0;
@@ -1856,7 +1856,7 @@ pub mod tests {
18561856
handle.await.unwrap();
18571857
}
18581858

1859-
#[sqlx::test(migrations = "../migrations")]
1859+
#[sqlx::test(migrations = "../../migrations")]
18601860
async fn test_deny_allow(pgpool: PgPool) {
18611861
async fn get_deny_status(sender_account: &ActorRef<SenderAccountMessage>) -> bool {
18621862
call!(sender_account, SenderAccountMessage::GetDeny).unwrap()
@@ -1956,7 +1956,7 @@ pub mod tests {
19561956
handle.await.unwrap();
19571957
}
19581958

1959-
#[sqlx::test(migrations = "../migrations")]
1959+
#[sqlx::test(migrations = "../../migrations")]
19601960
async fn test_initialization_with_pending_ravs_over_the_limit(pgpool: PgPool) {
19611961
// add last non-final ravs
19621962
let signed_rav = create_rav(*ALLOCATION_ID_0, SIGNER.0.clone(), 4, ESCROW_VALUE);
@@ -1982,7 +1982,7 @@ pub mod tests {
19821982
handle.await.unwrap();
19831983
}
19841984

1985-
#[sqlx::test(migrations = "../migrations")]
1985+
#[sqlx::test(migrations = "../../migrations")]
19861986
async fn test_unaggregated_fees_over_balance(pgpool: PgPool) {
19871987
// add last non-final ravs
19881988
let signed_rav = create_rav(*ALLOCATION_ID_0, SIGNER.0.clone(), 4, ESCROW_VALUE / 2);
@@ -2078,7 +2078,7 @@ pub mod tests {
20782078
handle.await.unwrap();
20792079
}
20802080

2081-
#[sqlx::test(migrations = "../migrations")]
2081+
#[sqlx::test(migrations = "../../migrations")]
20822082
async fn test_pending_rav_already_redeemed_and_redeem(pgpool: PgPool) {
20832083
// Start a mock graphql server using wiremock
20842084
let mock_server = MockServer::start().await;
@@ -2156,7 +2156,7 @@ pub mod tests {
21562156
handle.await.unwrap();
21572157
}
21582158

2159-
#[sqlx::test(migrations = "../migrations")]
2159+
#[sqlx::test(migrations = "../../migrations")]
21602160
async fn test_thawing_deposit_process(pgpool: PgPool) {
21612161
// add last non-final ravs
21622162
let signed_rav = create_rav(*ALLOCATION_ID_0, SIGNER.0.clone(), 4, ESCROW_VALUE / 2);
@@ -2208,7 +2208,7 @@ pub mod tests {
22082208
handle.await.unwrap();
22092209
}
22102210

2211-
#[sqlx::test(migrations = "../migrations")]
2211+
#[sqlx::test(migrations = "../../migrations")]
22122212
async fn test_sender_denied_close_allocation_stop_retry(pgpool: PgPool) {
22132213
// we set to 1 to block the sender on a really low value
22142214
let max_unaggregated_fees_per_sender: u128 = 1;

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ mod tests {
670670
)
671671
}
672672

673-
#[sqlx::test(migrations = "../migrations")]
673+
#[sqlx::test(migrations = "../../migrations")]
674674
async fn test_create_sender_accounts_manager(pgpool: PgPool) {
675675
let (_, (actor, join_handle)) = create_sender_accounts_manager(pgpool).await;
676676
actor.stop_and_wait(None, None).await.unwrap();
@@ -708,7 +708,7 @@ mod tests {
708708
)
709709
}
710710

711-
#[sqlx::test(migrations = "../migrations")]
711+
#[sqlx::test(migrations = "../../migrations")]
712712
async fn test_pending_sender_allocations(pgpool: PgPool) {
713713
let (_, state) = create_state(pgpool.clone()).await;
714714

@@ -732,7 +732,7 @@ mod tests {
732732
assert_eq!(pending_allocation_id.get(&SENDER.1).unwrap().len(), 2);
733733
}
734734

735-
#[sqlx::test(migrations = "../migrations")]
735+
#[sqlx::test(migrations = "../../migrations")]
736736
async fn test_update_sender_allocation(pgpool: PgPool) {
737737
let (prefix, (actor, join_handle)) = create_sender_accounts_manager(pgpool).await;
738738

@@ -766,7 +766,7 @@ mod tests {
766766
join_handle.await.unwrap();
767767
}
768768

769-
#[sqlx::test(migrations = "../migrations")]
769+
#[sqlx::test(migrations = "../../migrations")]
770770
async fn test_create_sender_account(pgpool: PgPool) {
771771
struct DummyActor;
772772
#[async_trait::async_trait]
@@ -803,7 +803,7 @@ mod tests {
803803
handle.await.unwrap();
804804
}
805805

806-
#[sqlx::test(migrations = "../migrations")]
806+
#[sqlx::test(migrations = "../../migrations")]
807807
async fn test_deny_sender_account_on_failure(pgpool: PgPool) {
808808
struct DummyActor;
809809
#[async_trait::async_trait]
@@ -857,7 +857,7 @@ mod tests {
857857
handle.await.unwrap();
858858
}
859859

860-
#[sqlx::test(migrations = "../migrations")]
860+
#[sqlx::test(migrations = "../../migrations")]
861861
async fn test_receive_notifications_(pgpool: PgPool) {
862862
let prefix = format!(
863863
"test-{}",

0 commit comments

Comments
 (0)