-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Rust Version
1.89
Diesel Version
latest master (d02221c)
Diesel Features
postgres
Database Version
17.5
Operating System Version
Manjaro Linux
What happened?
We have a database table with two foreign keys that both reference the same table. After upgrading to diesel-cli 2.3.2 and enabling the new feature allow_tables_to_appear_in_same_query_config = "fk_related_tables" this table is missing from allow_tables_to_appear_in_same_query in the generated schema. If allow_tables_to_appear_in_same_query_config is not specified, diesel::allow_tables_to_appear_in_same_query is correct. diesel::joinable! is also missing for this relation, but this probably makes sense as diesel cant join the tables automatically.
What did you expect to happen?
diesel::allow_tables_to_appear_in_same_query should include tables with multiple foreign keys to the same table.
Additional details
No response
Steps to reproduce
I wrote a test case on this branch, you can run it by cloning and then running cargo t --no-default-features --features postgres print_schema_fk_related_tables.
Here is the output:
Snapshot file: diesel_cli/tests/print_schema/print_schema_fk_related_tables/postgres/expected.snap
Snapshot: expected
Source: diesel_cli/tests/print_schema.rs:534
────────────────────────────
Test: print_schema_fk_related_tables
─────────────────────────────
-old snapshot
+new results
────────────┬───────────────
45 45 │ id -> Int4,
46 46 │ }
47 47 │ }
48 48 │
49 │-diesel::joinable!(comments -> posts (post_id));
50 49 │ diesel::joinable!(posts -> users (user_id));
51 50 │ diesel::joinable!(transactions -> sessions (session_id));
52 51 │
53 │-diesel::allow_tables_to_appear_in_same_query!(comments, posts, users,);
52 │+diesel::allow_tables_to_appear_in_same_query!(posts, users,);
54 53 │ diesel::allow_tables_to_appear_in_same_query!(sessions, transactions,);
────────────┴──────────────────
Compile time error
No response
Checklist
-
I have already looked over the issue tracker and the discussion forum for similar possible closed issues.
-
This issue can be reproduced on Rust's stable channel. (Please submit the issue in the Rust issue tracker instead if that's not the case)
-
This issue can be reproduced without requiring a third party crate
Metadata
Metadata
Assignees
Type
Projects
Status