mirror of
https://github.com/diesel-rs/diesel.git
synced 2024-10-04 17:47:17 +03:00
675ad32659
This enables one half of the two forms of multi-table joins. This commit enables joins in the form parent -> child -> grandchild. It does not allow parent -> child -> sibling. More concretely this means that tables implement `JoinTo<Join<...>>`, but `Join<...>` does not implement `JoinTo` for anything yet. I don't expect that any additional work will be required for the other half, just one blanket impl and a lot of tests. This also introduces the `enable_multi_table_joins!` macro. This macro will need to be invoked for any two tables that appear in a join together that do not have an association. This need will hopefully go away in the future, but will probably require specialization to be stable (and support projections on default types which it doesn't currently). The SQL here is slightly different than what you'd expect, but matches how we semantically treat this type of join. We will generate `SELECT * FROM (users INNER JOIN (posts INNER JOIN comments ON ...) ON ...)` rather than `SELECT * FROM users INNER JOIN posts ON ... INNER JOIN comments ON ...`. The query plan for these two queries is identical across all backends. |
||
---|---|---|
.. | ||
20170207193805_initial_schema | ||
20170209180355_add_one_off_tables_from_integration_tests | ||
20170211150830_index_columns_used_in_benchmarks | ||
20170215170122_create_trees | ||
20170219200159_add_foreign_key | ||
20170407152306_add_nullable_table | ||
20170603131224_add_likes |