Skip to content

Releases: vapor/fluent-kit

Performance and behavior improvements for encoding/decoding Fluent relations

11 Aug 02:30
7fc64d3
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

This PR addresses the following items:

  • The performance of eager loading for @Parent and @OptionalParent relations should now scale more strictly linearly rather than exhibiting eventually quadratic behavior. This only affects the last step of eager loading, and will probably only be noticeable in queries which eager load a very large number of small models.
  • The information contained by a FluentError.missingParent() error is now more complete and consistent.
  • The default Codable conformance provided to any type conforming to Fields (which includes all Models) should now be slightly but noticeably more performant; a number of unnecessary extra intermediate steps and repeated actions have been removed.
  • Errors thrown from the default Codable conformance on Fields now retain the full coding path of the entire coding operation, rather than only the failing key.
  • Setting an @OptionalParent property's value to nil (or more precisely, .some(.none)) no longer results in the property failing to encode its id.

There is a new protocol requirement on AnyCodableProperty - while it is not expected that external users need to be concerned with said requirement, it does technically make this a semver-minor update (see the comments on AnyCodableProperty.skipPropertyEncoding for details of the new property).

Add Siblings's `async`/`await` `detachAll(on:)` API

01 Aug 09:49
a0cae5b
Compare
Choose a tag to compare
This patch was authored by @jiahan-wu and released by @0xTim.

Adds missing async API for a sibling's detachAll(on:)

Log start and finish of migration prepares and reverts

25 Jul 16:08
d5c402e
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Also adds some documentation comments to the confusion that is Property.swift.

Shoutout to @dmonagle for being the first to point out to me that this logging was missing!

SchemaBuilder functions with @discardableResult

22 Jul 05:06
64f799f
Compare
Choose a tag to compare
This patch was authored by @dmonagle and released by @gwynne.

Added https://github.com/discardableResult to all functions in SchemaBuilder that modify Self and return Self. This brings it in line with QueryBuilder and also allows more complicated migrations that use conditional logic (ie not chained) to work without having to use let _ = to avoid Result of call to 'xxx' is unused warnings.

Add experimental watchOS support

13 Jul 09:24
a5360d8
Compare
Choose a tag to compare
This patch was authored by @krippz and released by @0xTim.

Add experimental support for watchOS

Resolves #500

Make it possible to drop foreign key constraints with MySQL 5.7

09 Jul 13:25
c49398f
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

This makes database.schema("table").deleteConstraint(.constraint(.foreignKey(...))).update() work correctly with a MySQL 5.7 server.

semver-minor because it deprecates a "public" API and adds a new one, even though neither API should actually be public.

Formatted boolean properties

01 Jul 00:45
1196025
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Adds two new property types to Fluent: @Boolean and @OptionalBoolean. These properties always have Bool values, and can be configured with a storage format, similarly to @Timestamp. For example, the .trueFalse format stores the strings "true" and "false" in the database, and parses those strings on load. If no format is specified, the database's default native format for Bool is used, equivalently to using @Field or @OptionalField. An appropriate column data type must be specified in the migration for the model.

Add ability to control transactions

30 Jun 14:46
2676424
Compare
Choose a tag to compare
This patch was authored and released by @0xTim.

Adds the ability to control starting, committing and rolling back transactions outside of the main Fluent API. This could be used for setting up tests or when you need more control over a transaction.

Introduces a new TransactionControlDatabase protocol to implement, that conforms to Database

Warning: It is the users' responsibility to ensure the handle errors and rollback when necessary and commit transactions

Additional API for pagination to access individual page

30 Jun 10:52
f5ae020
Compare
Choose a tag to compare
This patch was authored by @nashysolutions and released by @0xTim.

Adds the ability to get a single page when paginating a request:

let page = try await Model.query(on: req.db).page(withIndex: 2, size: 10)

Explicitly forbid unsupported combinations of @CompositeID with @Parent etc.

19 Jun 16:56
2b3ac05
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Stopgap workaround for #512 / #513