Releases: vapor/fluent-kit
Performance and behavior improvements for encoding/decoding Fluent relations
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 toFields
(which includes allModel
s) 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 onFields
now retain the full coding path of the entire coding operation, rather than only the failing key. - Setting an
@OptionalParent
property'svalue
tonil
(or more precisely,.some(.none)
) no longer results in the property failing to encode itsid
.
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
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
SchemaBuilder functions with @discardableResult
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
Make it possible to drop foreign key constraints with MySQL 5.7
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
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
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
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)