Skip to content

Releases: vapor/fluent-kit

1.48.0 - Primary Sendable support for Fluent

26 Apr 20:12
4fffbaa
Compare
Choose a tag to compare

What's Changed

Primary Sendable support for Fluent by @gwynne in #601

Adds as much Sendable correctness to FluentKit as it is possible to add.

[!IMPORTANT]
It was not possible to make Model correctly Sendable due to limitations of how property wrappers work, even though the wrappers themselves are Sendable. Users can get around this by adding @unchecked Sendable to each individual Model class, but this of course does not confer actual safety; it just disables the compiler’s warnings.

Also adds some missing APIs to FluentSQL to allow encoding Fluent models to SQLKit queries. The existing APIs for decoding Fluent models from SQLKit queries have been renamed, and the old names deprecated.

Other changes:

  • The performance improvements for Mirror are now used in Swift 5.10
  • QueryHistory is no longer thread-unsafe for reading
  • The minimum supported Swift version is now 5.8
  • SomeCodingKey is now an alias for SQLKit’s version
This patch was released by @gwynne

Full Changelog: 1.47.3...1.48.0

1.47.3 - Fix up FluentKit tests after SQLKit update

15 Apr 12:11
81db32f
Compare
Choose a tag to compare

What's Changed

Fix up FluentKit tests after SQLKit update by @gwynne in #599

Also bumps Swift minimum to 5.7 and adds ExistentialAny compliance.

This patch was released by @gwynne

Full Changelog: 1.47.2...1.47.3

1.47.2 - Skip DB execution when all ids for @OptionalParent are nil

23 Mar 01:37
5f0938a
Compare
Choose a tag to compare

What's Changed

Skip DB execution when all ids for @OptionalParent are nil by @mtj0928 in #583

OptionalParentEagerLoader doesn’t need to fetch To objects when all ids of the given models are nil, because the results of the DB execution will always be empty.

Therefore, I’ve modified the logic to skip the DB execution in such cases to improve performance.

New Contributor

This patch was released by @gwynne

Full Changelog: 1.47.1...1.47.2

1.47.1 - Explicitly set all columns when creating arrays of models

17 Feb 11:17
bb47433
Compare
Choose a tag to compare

What's Changed

Explicitly set all columns when creating arrays of models by @gwynne in #595

When performing an insert query (the “create” model action), we now explicitly emit DEFAULT as the value for fields which have not been set. This ensures that when creating an array of models, the column count for each individual model is the same even if not all fields are set on each one, avoiding a fatal error.

Fixes #594.

This patch was released by @gwynne

Full Changelog: 1.47.0...1.47.1

1.47.0 - Relax restrictions on ModelAlias use and join conditions

01 Feb 19:35
3ae5187
Compare
Choose a tag to compare

What's Changed

Relax restrictions on ModelAlias use and join conditions by @gwynne in #593

  1. Relaxes most of Fluent’s filter operators to only require Schema conformance rather than Model. This enables ModelAlias usage with all operators that it previously didn’t work for.
  2. Enables all model value filters in joins (e.g. join(Foo.self, on: \Foo.$bar.$id == \Bar.$id && \Bar.$value > 4)).
  3. Adds .sql(raw:), .sql(embed:), and .sql(_:) for Fluent joins.

(Note: Not a semver-major break because the new generic requirements on operators are always strict supersets of the old ones.)

Supersedes #432. Fixes #431. Fixes #536.

This patch was released by @gwynne

Full Changelog: 1.46.0...1.47.0

1.46.0 - Add `@discardableResult` to QueryBuilder's range and sort methods

31 Jan 12:46
0a2b448
Compare
Choose a tag to compare

What's Changed

Add @discardableResult to QueryBuilder's range and sort methods by @jiahan-wu in #592

This Pull Request addresses an issue where calling the sort methods in the QueryBuilder class would result in a “Result of call to ‘sort’ is unused” warning. To resolve this, I have added the @discardableResult attribute to these methods, allowing users to call them without triggering the warning when the result is not explicitly used.

This patch was released by @gwynne

Full Changelog: 1.45.1...1.46.0

1.45.1 - Make DatabaseID Sendable

10 Jan 17:22
6cef853
Compare
Choose a tag to compare

What's Changed

Make DatabaseID Sendable by @adam-fowler in #590

Add Sendable conformance to DatabaseID.

Make DatabaseID Sendable

This patch was released by @0xTim

Full Changelog: 1.45.0...1.45.1

1.45.0 - Allow pivot editing closures to be async and throwing.

17 Sep 14:01
e0bb2b0
Compare
Choose a tag to compare

What's Changed

Allow pivot editing closures to be async and throwing. by @gwynne in #585

When using the attach(_:method:on:_:) and attach(_:on:_:) methods of SiblingsProperty, the optional closure provided to allow editing new pivots before they are saved can now optionally be both throws and async.

Closes #581.

Additional changes:

  • All versions of the isAttached(), attach(), and detach() methods of SiblingsProperty will now throw errors (specifically cases of the new SiblingsPropertyError enum) instead of calling fatalError() when an unsaved model is encountered.

Reviewers

Thanks to the reviewers for their help:

This patch was released by @gwynne

Full Changelog: 1.44.1...1.45.0

1.44.1 - Correctly handle @OptionalEnum properties when using ~~ and != in filter()

16 Aug 08:25
ccea982
Compare
Choose a tag to compare

What's Changed

Correctly handle @OptionalEnum properties when using ~~ and != in filter() by @gwynne in #580

We were incorrectly hardcoding the use of .bind query values when using the ~~ (contains) and !~ (not contains) operators with properties having optional values in Fluent filter() expressions. This appears to be the only place where this was still happening.

Reviewers

Thanks to the reviewers for their help:

This patch was released by @gwynne

Full Changelog: 1.44.0...1.44.1

1.44.0 - Fully work around MySQL 5.7's lack of the DROP CONSTRAINT statement

30 Jul 02:09
e562a10
Compare
Choose a tag to compare

What's Changed

Fully work around MySQL 5.7's lack of the DROP CONSTRAINT statement in #575

The work done in #522 added the ability to drop foreign keys when using a MySQL 5.7 database by enabling Fluent to generate the necessary DROP FOREIGN KEY syntax to make up for the old version's lack of the more standard and more flexible DROP CONSTRAINT statement.

However, this still required users to specify the complete and current foreign key constraint definition at the time of deletion so Fluent could work out the correct "normalized" constraint identifier. These changes make it possible to also drop a foreign key constraint by name, requiring only the knowledge that it is, in fact, a foreign key.

Users wishing to drop foreign key constraints by name when using MySQL 5.7 must use the new API provided. Users of other versions of MySQL and other databases may also use the new API, or continue to use the old one.

New APIs added in this release:

Fixes #491, vapor/fluent#722. Supersedes #492, #522.

This patch was released by @gwynne.

Full Changelog: 1.43.2...1.44.0