Releases: vapor/fluent-kit
Complex join conditions and composite-key parent relations
This patch was authored and released by @gwynne.
This release includes significant feature additions, cleanups, and improvements:
- More complex conditions are now supported when using
.join()in queries; the!=operator is now supported, and conditions may be combined using&&. - The new
@CompositeParentproperty type may be used to reference a model which uses@CompositeIDas the parent of another model. ModelAliasnow works in most cases that were previously broken; among other cases, it is now possible to alias models which specify aspace.- The poorly-considered "duplicate"
SQLListtype previously available inFluentSQLis now deprecated; useSQLKit's version instead. - Various code cleanups and minor performance improvements.
FieldsandModelAliasnow have detailed code documentation.- A new type,
SomeCodingKey, is now available, providing a complete implementation ofCodingKeyfor convenience in various cases when arbitrary string or integer keys are desired. - The SQL generated by FluentKit queries should now be slightly more consistent.
Fix support for composite ID models with QueryBuilder.count()
This patch was authored and released by @gwynne.
This functionality appeared to exist before but would actually crash at runtime. We now handle it correctly, including a test.
Allow use of create and delete for arrays of models that have composite IDs.
This patch was authored and released by @gwynne.
We no longer crash in a precondition failure when attempting to invoke Fluent's .create() and .delete() extensions to Collection. This in particular enables the use of Siblings.attach(_:on:edit:) with pivots which use a composite ID (most often consisting of the two parent relations).
Additional changes:
- Swift 5.4 support removed.
- NIO deprecation warnings fixed.
Revised error handling in Encodable conformance for Fields
This patch was authored and released by @gwynne.
This allows the fixes in vapor/postgres-kit#234 and vapor/mysql-kit#313 to work correctly and adds testing of the affected functionality.
Remove several sources of fatal errors from @Group
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
@Parentand@OptionalParentrelations 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
Codableconformance provided to any type conforming toFields(which includes allModels) 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
Codableconformance onFieldsnow retain the full coding path of the entire coding operation, rather than only the failing key. - Setting an
@OptionalParentproperty'svaluetonil(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.