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

Index join tables on the B side #561

Merged
merged 1 commit into from Mar 6, 2020

Conversation

tomhoule
Copy link
Contributor

@tomhoule tomhoule commented Mar 6, 2020

Previously, Prisma join tables (for many-to-many relations) only had a
unique index on the A columns + B columns, but that could not be used
when the relation is queried from the B side.

This commit adds an index on the foreign key columns for B.

closes #554

Previously, Prisma join tables (for many-to-many relations) only had a
unique index on the A columns + B columns, but that could not be used
when the relation is queried from the B side.

This commit adds an index on the foreign key columns for B.
@tomhoule tomhoule added the tech/engines/migration engine Issue in the Migration Engine label Mar 6, 2020
@tomhoule tomhoule added this to the Preview 24 New milestone Mar 6, 2020

let table = sql::Table {
name: relation.table_name(),
columns,
indices: vec![index],
indices: indexes,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmh

@tomhoule tomhoule marked this pull request as ready for review March 6, 2020 10:15
Comment on lines -507 to -527
#[test]
#[ignore]
fn adding_a_many_to_many_relation_for_exotic_id_types_must_work() {
// TODO: add this once we have figured out what id types we support
unimplemented!();
}

#[test]
#[ignore]
fn forcing_a_relation_table_for_a_one_to_many_relation_must_work() {
// TODO: implement this once we have decided if this is actually possible in dm v2
unimplemented!();
}

// #[test]
// #[ignore]
// fn forcing_a_relation_table_for_a_one_to_many_relation_must_work() {
// // TODO: implement this once we have decided if this is actually possible in dm v2
// unimplemented!();
// }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tomhoule tomhoule merged commit 1ef40c2 into master Mar 6, 2020
@tomhoule tomhoule deleted the migration-engine/second-index-on-join-tables branch March 6, 2020 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech/engines/migration engine Issue in the Migration Engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ME: Many-to-many table indices sub-optimal
2 participants