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

Prepare v2.0.0 rc.1 #3237

Merged
merged 149 commits into from
Jul 22, 2022
Merged

Prepare v2.0.0 rc.1 #3237

merged 149 commits into from
Jul 22, 2022

Conversation

weiznich
Copy link
Member

No description provided.

weiznich and others added 30 commits April 22, 2022 17:35
This commit fixes potential name collisions in code generated by the
`table!` macro by prefixing function argument names with
`__diesel_internal`. The underlying problem here is that rust accepts
patterns as part of the function signature. This combined with the fact
that each zero sized struct (so all column/table structs) are type +
value at the same time results in problems as soon as the users tries to
create a column/table with the same name as one of the used arguments.
So for example if the users has a table that contains an `alias` column,
that would have caused a name collision inside of the following function
signature:

```rust
fn map(column: C, alias: &$crate::query_source::Alias<S>) -> Self::Out
```

Rustc would have interpreted `alias` here as zero sized struct literal,
which of course has a different type than the corresponding RHS. That
results in a compiler error about mismatched types.

This commit fixes this problem by prefixing the corresponding variables
with `__diesel_internal`, which is hopefully reasonably uncommon, so
that no one uses that as column name prefix.
…table_macro

Fix potential name collisions in code generated by the `table!` macro
Co-authored-by: Christopher Fleetwood <[email protected]>
Fixed believed error in documentation
Allow `ORDER BY` clauses to be used in any combination subquery by
either put parenthesis around the subqueries (Postgres/Mysql) or adding
a wrapping subquery (Sqlite).
…hods

Add like, not_like and concat for PostgreSQL Bytea
…explicit_sort

Allow `DISTINCT ON` to be used with queries containing an explicit sort order
Our `R2D2Connection::is_broken` implementations where broken in such a
way that they marked any valid connection as broken as soon as it was
checked into the pool again. This resulted in the pool opening new
connections everytime a connection was checked out of the pool, which
obviously removes the possibility of reusing the same connection again
and again. This commit fixes that issue and adds some tests to ensure
that we do not break this again in the future.
This commit replaces some recursive macros with simpler implementations
by generating non recursive where clauses by just forwarding to the next
smaller impl on the corresponding tuple.
According to my measurements this reduces the build time for a `cargo
check --no-default-features --features "sqlite 64-column-table"` build
from ~1min 20s to ~1min 05s.
Technically this seems to be a breaking change, but as we haven't
released 2.0 yet this is fine.
@weiznich weiznich requested a review from a team July 19, 2022 11:11
weiznich and others added 9 commits July 19, 2022 13:15
Some people don't like to write down migrations, as depending on your workflow, they take a lot of time to write, are *never* used (esp. when you have CD pipelines), and consequently are typically largely untested.

We support this for those (like us) who would rather write a new `up` migration to revert unwanted changes through CI/CD if necessary.

(NB: The original issue is that since we wouldn't fill down.sql, we would have to go edit that file to add a newline for formatting everytime we create a migration, and then leave it there even though it doesn't mean anything.)
Note: it would probably be possible to have a more strongly typed
implementation that prevents from calling revert when down.sql is not
present but not sure if that's worth the complexity.
Co-authored-by: Georg Semmler <[email protected]>
CLI: Allow running without a `down.sql` migration
@Ten0
Copy link
Member

Ten0 commented Jul 20, 2022

Ah we may want to do the "add documentation" about #3216 (reply in thread) as well somewhere as people are likely to read it these days?

@weiznich
Copy link
Member Author

@Ten0 Mind opening a PR for this?

weiznich and others added 4 commits July 21, 2022 08:58
This commit adds some notes about the used join syntax and how this can
affect query planing on postgres based on the discussion in diesel-rs#3216.

Additionally it removes the restricting that the same table cannot be
joined twice. Instead we point to `diesel::alias!` now.
Improve the documentation of `QueryDsl::inner_join`
@weiznich weiznich changed the title Prepare v2.0.0 rc.0 Prepare v2.0.0 rc.1 Jul 21, 2022
@weiznich
Copy link
Member Author

@Ten0 I've opened (and already landed) #3240 for this. It is included in this PR as well. Anything else to include?

@Ten0
Copy link
Member

Ten0 commented Jul 22, 2022

@Ten0 I've opened (and already landed) #3240 for this. It is included in this PR as well. Anything else to include?

Good for me for rc1 :)

@weiznich weiznich merged commit 6cfa5f3 into diesel-rs:2.0.x Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.