Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Nov 27, 2024
1 parent 2dd7499 commit 51554b1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions schema-engine/sql-migration-tests/tests/migrations/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,11 @@ fn migrations_with_many_to_many_related_models_must_not_recreate_indexes(api: Te

api.schema_push_w_datasource(dm_1).send().assert_green();
api.assert_schema().assert_table("_ProfileToSkill", |t| {
t.assert_index_on_columns(&["A", "B"], |idx| idx.assert_is_unique())
if api.is_postgres() {
t.assert_pk(|pk| pk.assert_columns(&["A", "B"]))
} else {
t.assert_index_on_columns(&["A", "B"], |idx| idx.assert_is_unique())
}
});

let dm_2 = r#"
Expand All @@ -1017,9 +1021,16 @@ fn migrations_with_many_to_many_related_models_must_not_recreate_indexes(api: Te

api.schema_push_w_datasource(dm_2).send().assert_green();
api.assert_schema().assert_table("_ProfileToSkill", |table| {
table.assert_index_on_columns(&["A", "B"], |idx| {
idx.assert_is_unique().assert_name("_ProfileToSkill_AB_unique")
})
if api.is_postgres() {
table.assert_pk(|pk| {
pk.assert_columns(&["A", "B"])
.assert_constraint_name("_ProfileToSkill_AB_pk")
})
} else {
table.assert_index_on_columns(&["A", "B"], |idx| {
idx.assert_is_unique().assert_name("_ProfileToSkill_AB_unique")
})
}
});

// Check that the migration is idempotent
Expand Down

0 comments on commit 51554b1

Please sign in to comment.