# \#fluent

**URL:** https://forums.swift.org/tag/fluent/90.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Implicit Fluent Chaining](https://forums.swift.org/t/implicit-fluent-chaining/86660)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 4\
**Last updated:** [May 12, 2026, 12:22pm UTC](https://forums.swift.org/t/implicit-fluent-chaining/86660 "2026-05-12T12:22:08Z")

</div>

Pitch idea: Implicit Fluent Chaining Motivation Builder-style configuration is common in Swift but requires mechanical boilerplate for every settable property: // value types: extension S { consuming func foo(\_ v: I…

---

## [Representation of an array of custom product type in Fluent ORM](https://forums.swift.org/t/representation-of-an-array-of-custom-product-type-in-fluent-orm/81554)

<div class="topic-metadata">

**Author:** [@makabaka1880](https://forums.swift.org/u/makabaka1880)\
**Replies:** 1\
**Last updated:** [August 9, 2025, 12:21pm UTC](https://forums.swift.org/t/representation-of-an-array-of-custom-product-type-in-fluent-orm/81554 "2025-08-09T12:21:32Z")

</div>

Long story short, how do you represent a field with the type of (an array of (a custom product type)) in Fluent? Hi there, nice people from the Swift forum, we’re building a game backend with Vapor + Fluent + PSQL. O…

---

## [Fluent db migration fails](https://forums.swift.org/t/fluent-db-migration-fails/75626)

<div class="topic-metadata">

**Author:** [@Will](https://forums.swift.org/u/Will)\
**Replies:** 8\
**Last updated:** [July 29, 2025, 9:48am UTC](https://forums.swift.org/t/fluent-db-migration-fails/75626 "2025-07-29T09:48:59Z")

</div>

I'm trying to connect to mysql db on clever cloud dev account. I'm able to query the db in my vapor app fine. However, I cannot run migrate to create tables. I get the following error: \[ ERROR \] Opening new connection f…

---

## [How to filter a nested relationship with Vapor Fluent](https://forums.swift.org/t/how-to-filter-a-nested-relationship-with-vapor-fluent/77973)

<div class="topic-metadata">

**Author:** [@AndrewBoryk](https://forums.swift.org/u/AndrewBoryk)\
**Replies:** 3\
**Last updated:** [February 25, 2025, 1:57pm UTC](https://forums.swift.org/t/how-to-filter-a-nested-relationship-with-vapor-fluent/77973 "2025-02-25T13:57:28Z")

</div>

I have a relationship that is structured like: Book { id: UUID author: Author } Author { id: UUID genre: Genre } Genre { id: UUID name: String } I want to be able to query for books that have author…

---

## [Fluent query does not finish](https://forums.swift.org/t/fluent-query-does-not-finish/77980)

<div class="topic-metadata">

**Author:** [@sspringer](https://forums.swift.org/u/sspringer)\
**Replies:** 1\
**Last updated:** [February 20, 2025, 12:05pm UTC](https://forums.swift.org/t/fluent-query-does-not-finish/77980 "2025-02-20T12:05:15Z")

</div>

I am trying to use Fluent to get data from within a Hummingbird application and the following query over a very small table does not finish, without any error message: let projects = try await Project.query(on: fluent.d…

---

## [Inheritance in Fluent+Postgres?](https://forums.swift.org/t/inheritance-in-fluent-postgres/75862)

<div class="topic-metadata">

**Author:** [@catalandres](https://forums.swift.org/u/catalandres)\
**Replies:** 0\
**Last updated:** [November 6, 2024, 6:07pm UTC](https://forums.swift.org/t/inheritance-in-fluent-postgres/75862 "2024-11-06T18:07:43Z")

</div>

Does Fluent support inheritance (link) (link) when running against Postgres? I couldn't find anything on the topic in the documentation and I noticed that other ORMs do solve for it.

---

## [Trouble connecting to mysql](https://forums.swift.org/t/trouble-connecting-to-mysql/75544)

<div class="topic-metadata">

**Author:** [@Will](https://forums.swift.org/u/Will)\
**Replies:** 15\
**Last updated:** [October 24, 2024, 6:07pm UTC](https://forums.swift.org/t/trouble-connecting-to-mysql/75544 "2024-10-24T18:07:06Z")

</div>

I created a new vapor project with Fluent and I'm having trouble connecting to my mysql instance on my Synology server. I tried a different db management app with the same credentials and connection settings and it works…

---

## [\`fatalError\` without a way to intercept it is harmful on the server](https://forums.swift.org/t/fatalerror-without-a-way-to-intercept-it-is-harmful-on-the-server/74386)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 13\
**Last updated:** [September 14, 2024, 12:27am UTC](https://forums.swift.org/t/fatalerror-without-a-way-to-intercept-it-is-harmful-on-the-server/74386 "2024-09-14T00:27:33Z")

</div>

Hi. I have recently come to conclusion that there must be a way to gracefully recover from the fatalError (at least on the server, perhaps, as a compiler flag). Because otherwise, it becomes a land mine when it is used …

---

## [SQL-Kit, sqlite and pragma commands](https://forums.swift.org/t/sql-kit-sqlite-and-pragma-commands/71570)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 8:33am UTC](https://forums.swift.org/t/sql-kit-sqlite-and-pragma-commands/71570 "2024-05-02T08:33:28Z")

</div>

UPDATE: Scratch this topic because simply restarting fixed the issue. But does anyone know if the SQLite-kit support WAL2? Hi everyone. I am sending a pragma command to the SQLite after booting the server, but when I m…

---

## [What is Correct Syntax for Group By (if any)?](https://forums.swift.org/t/what-is-correct-syntax-for-group-by-if-any/71459)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 2\
**Last updated:** [April 26, 2024, 6:06am UTC](https://forums.swift.org/t/what-is-correct-syntax-for-group-by-if-any/71459 "2024-04-26T06:06:11Z")

</div>

Hi. I have a rather straightforward problem with Vapor Fluent. Given three models — Group, Member, Role (Group to Member is one-to-many and Member to Role is many-to-many), I need to find all members for a given list of…

---

## [Database Configuration Middleware](https://forums.swift.org/t/database-configuration-middleware/62441)

<div class="topic-metadata">

**Author:** [@Jstaud](https://forums.swift.org/u/Jstaud)\
**Replies:** 7\
**Last updated:** [May 4, 2023, 12:47am UTC](https://forums.swift.org/t/database-configuration-middleware/62441 "2023-05-04T00:47:30Z")

</div>

So I'm attempting to write a middleware method that can provide the main application with a database connection declared using the requesting user's credentials that are pulled from a top-level database. I'm building out…

---

## [How to only select rows with no children?](https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 1\
**Last updated:** [January 25, 2024, 10:54am UTC](https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620 "2024-01-25T10:54:36Z")

</div>

Hi. I have a model that can have children (one-to-many relationship to a different model) and I would like to find all rows that have no children. Is there a way to do it without writing raw SQL? Thank you!

---

## [Issue with Fluent: Property to Field Conversion](https://forums.swift.org/t/issue-with-fluent-property-to-field-conversion/67210)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 1\
**Last updated:** [September 12, 2023, 1:10am UTC](https://forums.swift.org/t/issue-with-fluent-property-to-field-conversion/67210 "2023-09-12T01:10:18Z")

</div>

Hi. I can't find any information how model properties are mapped to their database representation. Can anyone point in the right direction? I am having an issue with IP address stored as String in the Model failing to b…

---

## [Confused about Vapor (Fluent?) errors](https://forums.swift.org/t/confused-about-vapor-fluent-errors/63733)

<div class="topic-metadata">

**Author:** [@henrikac](https://forums.swift.org/u/henrikac)\
**Replies:** 9\
**Last updated:** [March 17, 2023, 11:50am UTC](https://forums.swift.org/t/confused-about-vapor-fluent-errors/63733 "2023-03-17T11:50:11Z")

</div>

Hi :slight\_smile: After adding the following guard statement in my route I get what feels like a million error messages and not really sure why guard let activity = try await PersonActivity.query(on: req.db) .filte…

---

## [Vapor issue with eager loading](https://forums.swift.org/t/vapor-issue-with-eager-loading/63670)

<div class="topic-metadata">

**Author:** [@henrikac](https://forums.swift.org/u/henrikac)\
**Replies:** 2\
**Last updated:** [March 14, 2023, 3:27pm UTC](https://forums.swift.org/t/vapor-issue-with-eager-loading/63670 "2023-03-14T15:27:14Z")

</div>

Hi :slight\_smile: I have the following route func detail(req: Request) async throws -\> User.ReadDTO { guard let userId = req.userId else { throw Abort(.unauthorized) } l…

---

## [UUID does not conform to 'QueryableProperty'](https://forums.swift.org/t/uuid-does-not-conform-to-queryableproperty/63286)

<div class="topic-metadata">

**Author:** [@Jstaud](https://forums.swift.org/u/Jstaud)\
**Replies:** 2\
**Last updated:** [February 22, 2023, 3:29pm UTC](https://forums.swift.org/t/uuid-does-not-conform-to-queryableproperty/63286 "2023-02-22T15:29:27Z")

</div>

I am trying to query a postgres DB using the Fluent ORM and I'm attempting to filter a query based on it's parent class 'User' UUID value. The following code throws the error: Operator function '==' requires that 'UUID' …

---

## [Saving JSON in Postgres table with Fluent](https://forums.swift.org/t/saving-json-in-postgres-table-with-fluent/62074)

<div class="topic-metadata">

**Author:** [@Jstaud](https://forums.swift.org/u/Jstaud)\
**Replies:** 3\
**Last updated:** [January 5, 2023, 10:16pm UTC](https://forums.swift.org/t/saving-json-in-postgres-table-with-fluent/62074 "2023-01-05T22:16:30Z")

</div>

Does anyone have a recommendation for how to go about capturing the entire JSON body from a request and save it, along with some of the JSON contents, to a PSQL table? I have a column defined for the json: .field(.strin…

---

## [Composing property wrappers in Swift with Vapor + Fluent](https://forums.swift.org/t/composing-property-wrappers-in-swift-with-vapor-fluent/56079)

<div class="topic-metadata">

**Author:** [@jacobcxdev](https://forums.swift.org/u/jacobcxdev)\
**Replies:** 1\
**Last updated:** [August 18, 2022, 1:29pm UTC](https://forums.swift.org/t/composing-property-wrappers-in-swift-with-vapor-fluent/56079 "2022-08-18T13:29:50Z")

</div>

I've implemented a system to automatically generate Fluent's Migrations by reflecting 'registered' Models, saving the boilerplate of creating them manually. To achieve this, I must allow the specification of any Database…

---

## [CRUD Operation ISSUE in fluent](https://forums.swift.org/t/crud-operation-issue-in-fluent/53312)

<div class="topic-metadata">

**Author:** [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Replies:** 5\
**Last updated:** [November 6, 2021, 2:14pm UTC](https://forums.swift.org/t/crud-operation-issue-in-fluent/53312 "2021-11-06T14:14:45Z")

</div>

Issue: Not able to retrieve first acronym as response. I have created a get request in the code for accessing all the acronyms from the db and then I have created a get request for accessing a single acronymID. I am…

---

## [Postman post issue](https://forums.swift.org/t/postman-post-issue/53010)

<div class="topic-metadata">

**Author:** [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Replies:** 4\
**Last updated:** [October 23, 2021, 5:46pm UTC](https://forums.swift.org/t/postman-post-issue/53010 "2021-10-23T17:46:07Z")

</div>

I am new to Postman so here is my beginner friendly doubt. :joy::joy: I am trying to create a POST request on Postman but its giving me an error. I checked for possible mistakes on stack overflow and I have kept conten…

---

## [Is there a lifecycle hook for reading a Fluent model?](https://forums.swift.org/t/is-there-a-lifecycle-hook-for-reading-a-fluent-model/43769)

<div class="topic-metadata">

**Author:** [@cgrindel](https://forums.swift.org/u/cgrindel)\
**Replies:** 2\
**Last updated:** [January 12, 2021, 5:39pm UTC](https://forums.swift.org/t/is-there-a-lifecycle-hook-for-reading-a-fluent-model/43769 "2021-01-12T17:39:21Z")

</div>

I have a database table called foos which has two fields, id and protobuf\_data. return database.schema("foos") .id() .field("protobuf\_data", .data, .required) .create() The protobuf\_data contains …

---

## [Lazy loading of @Sibling relation](https://forums.swift.org/t/lazy-loading-of-sibling-relation/39451)

<div class="topic-metadata">

**Author:** [@JetForMe](https://forums.swift.org/u/JetForMe)\
**Replies:** 1\
**Last updated:** [August 17, 2020, 6:54am UTC](https://forums.swift.org/t/lazy-loading-of-sibling-relation/39451 "2020-08-17T06:54:25Z")

</div>

I have a schema with User, Organization, and UserOrganization pivot table. I want my /users/current endpoint to return a UserDTO with the user’s organizations filled out. I'm trying to do it like this: func getCurrentU…

---

## [Solution for using services in a fluent lifecycle event](https://forums.swift.org/t/solution-for-using-services-in-a-fluent-lifecycle-event/18218)

<div class="topic-metadata">

**Author:** [@monagle](https://forums.swift.org/u/monagle)\
**Replies:** 1\
**Last updated:** [November 27, 2018, 6:30pm UTC](https://forums.swift.org/t/solution-for-using-services-in-a-fluent-lifecycle-event/18218 "2018-11-27T18:30:36Z")

</div>

Hi all, I'm interested to know if there is an official or accepted way to achieve the following: I have a model that is persisted to a postrgresql database. I also have an indexing service based on elasticsearch. For e…

---

## [How to select different associated type based on type constraints?](https://forums.swift.org/t/how-to-select-different-associated-type-based-on-type-constraints/17214)

<div class="topic-metadata">

**Author:** [@twof](https://forums.swift.org/u/twof)\
**Replies:** 7\
**Last updated:** [November 8, 2018, 1:41pm UTC](https://forums.swift.org/t/how-to-select-different-associated-type-based-on-type-constraints/17214 "2018-11-08T13:41:40Z")

</div>

extension CrudController: CrudControllerProtocol { public typealias ModelType = ModelT } extension CrudController where ModelT: Publicable { public typealias ReturnModelType = ModelT.PublicModel } extension Cru…

---

## [Vapor+Fluent and 2 foreign keys to same parent table](https://forums.swift.org/t/vapor-fluent-and-2-foreign-keys-to-same-parent-table/13488)

<div class="topic-metadata">

**Author:** [@gahms](https://forums.swift.org/u/gahms)\
**Replies:** 1\
**Last updated:** [June 13, 2018, 5:57pm UTC](https://forums.swift.org/t/vapor-fluent-and-2-foreign-keys-to-same-parent-table/13488 "2018-06-13T17:57:59Z")

</div>

I am trying to do 2 joins to the same parent table on two different columns. Is this even possible? What I have: func allItemsHandler(\_ req: Request) throws -\> Future\<View\> { let templateName = "\\(\_itemsName…
