Releases: vapor/fluent-kit
Add ability to specify `IF NOT EXISTS` for schema create actions
This patch was authored and released by @gwynne.
- Takes the form of a new API on
SchemaBuilder
and additional flag onDatabaseSchema
. The behavior is 100% backwards compatible. - Specifying this flag has no effect on
.update
or.delete
schema actions. - This flag has no effect on the MongoDB driver.
MigrationLog
now both uses this flag and issues its create action unconditionally instead of gating it behind a spurious query; as a result, it no longer issues an error message whenever migrations are run on an empty database (which may happen often in comprehensive unit tests). This should not be a breaking change for anyone.- If
MigrationLog
's schema ever needs to change in the future, the use of this flag will require additional code be added to support that requirement. Hopefully the schema should not change short of asemver-major
upgrade.
Handle SQL Bind Values in EnumProperty
This patch was authored and released by @calebkleveter.
When you decode a Fields
type from a database row that has an Enum
property, because the Enum.decode(from:)
method simply calls its internal field.decode(from:)
method, the field.inputValue
property ends up having a .bind
case with a perfectly valid case name as it's associated value. This release adds handling to the EnumProperty.value
property for the .bind
case.
Fix @Enum codable serialization
This patch was authored by @jccampagne and released by @tanner0101.
Fixes an error when encoding @Enum
fields using Codable (#198).
Batch update timestamps at the same time
This patch was authored and released by @tanner0101.
Updates the batch model creation method to set timestamps to the same value (#197, #125).
Omit empty filter groups from query
This patch was authored and released by @tanner0101.
QueryBuilder filter groups that have no filters are now omitted from the query (#195, fixes #9).
Pass join method parameter
This patch was authored by @varungakhar and released by @tanner0101.
Correctly passes join method parameter through to underlying methods (#193).
Add XCTFluent module with TestDatabase
This patch was authored by @mattpolzin and released by @tanner0101.
Adds new XCTFluent
module for testing. This includes a TestDatabase
helper that lets you mock the row results for each query (#110).
let db = TestDatabase()
db.append(queryResult: [])
db.append(queryResult: [
TestOutput(["id": ..., "name": "Earth"])
])
try Planet.query(on: db).all().wait() // []
try Planet.query(on: db).all().wait() // [Planet(id: ..., name: "Earth")]
Improve invalid @Field access fatalError
This patch was authored by @grosch and released by @tanner0101.
Improves error messages when invalid access to @Field
causes a fatalError (#182).
Siblings detach array support
Add array support to @Siblings.detach(_:on:)
(#191, fixes #179).
earth.$tags.detach([smallRocky, inhabited], on: db)
This patch was authored and released by @tanner0101.
Make MigrationLog's name unique
Adds a unique constraint to the MigrationLog schema (#190, fixes #189).
For existing databases, use SQL similar to the following to add this constraint manually.
ALTER TABLE "_fluent_migrations" CONSTRAINT "uq:_fluent_migrations.name" UNIQUE ("name")
This patch was authored and released by @tanner0101.