New:
- Generic database queries:
QueryBuilderandSchemaBuildernow store query types generic to each specific database. This means you can now do much of what required raw SQL queries with type-safe Swift! Timestampable&SoftDeletableare now part of Model: This allows for users to opt in to exactly which timestamps they would like to use. It also removes a lot of type-erasing and casting that needed to happen internally. New lifecycle hooks have been added for soft-deletion as well.- Generic transactions + convenience methods: Transactions now allow for a generic return type. Use the new convenience method on
DatabaseConnectableto perform a transaction. - Data and KeyPath conversion failures are now assertions. This makes working with Fluent a lot easier (huge reduction in
trystatements) for what really should be develop-time errors. - Aggregates are now generic.
- New
update(data:)andcreate(data:)methods onQueryBuilderallow for easy batch updates. - Joins now support joining additional models to previously joined tables.
Fixed:
- Tons of bug fixes throughout Fluent and all of its drivers.
Breaking changes:
Modelentity now defaults to the model's type name. It no longer attempts to create a lowercased, pluralized string. Implementstatic var entity: Stringon your model if you want to define a custom entity (#492).TimestampableandSoftDeletablekey paths must now be optional. Not-implementing these key paths (or returningnil) is equivalent to not conforming to the protocol.joinmethods have been simplified:join(\Pet.userID, to: \User.id)- Please report any breaking changes you notice not listed--they may be unintentional