Skip to content

Releases: vapor/fluent-kit

Add ability to specify `IF NOT EXISTS` for schema create actions

17 Mar 13:51
a15e8c5
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.
  • Takes the form of a new API on SchemaBuilder and additional flag on DatabaseSchema. 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 a semver-major upgrade.

Handle SQL Bind Values in EnumProperty

12 Mar 22:29
395f983
Compare
Choose a tag to compare
Pre-release
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

06 Mar 23:15
dc7554d
Compare
Choose a tag to compare
Pre-release
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

06 Mar 21:38
75264a6
Compare
Choose a tag to compare
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

06 Mar 21:10
7922c9b
Compare
Choose a tag to compare
Pre-release
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

06 Mar 16:47
26d07ea
Compare
Choose a tag to compare
Pre-release
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

06 Mar 16:10
1aed57c
Compare
Choose a tag to compare
Pre-release
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

05 Mar 20:38
a0653f7
Compare
Choose a tag to compare
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

04 Mar 19:39
f8e8f3b
Compare
Choose a tag to compare
Pre-release

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

04 Mar 18:15
ef735c6
Compare
Choose a tag to compare
Pre-release

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.