Swift 5.2 (released in Xcode 11.4) has a regression causing valid Vapor 3 Fluent code to no longer compile.
You can read more about this regression in SR-12354. This forum post will show you a couple ways to work around for the (hopefully short) time being.
The regression affects Vapor 3 projects using Fluent and migrations. The bug affects code using leading-dot syntax to reference a database identifier when configuring migrations.
It can also be fixed by specifying the Database typealias on the model.
final class Todo: SQLiteModel {
// Swift 5.2 requires this even though SQLiteModel constrains Database
// to this exact type.
typealias Database = SQLiteDatabase
...
}
This issue only shows up in projects. Both the vapor and fluent packages continue to compile fine. Seems like we need to add some example vapor projects to the compat suite.
Looks like the compat suite only has the Fluent module which continues to pass tests. If it would have been testing the drivers as well (FluentSQLite, FluentMySQL, and FluentPostgres) it would have seen the issue. The drivers build fine, but their test suites don't.
It also doesn't affect every invocation of it. I have a project with around 40 models and migrations in, only 7 needed changing to make the type checker happy