Last active
May 31, 2020 12:48
-
-
Save cweinberger/a81e6af7abf4c1f3694ec7faf8b73156 to your computer and use it in GitHub Desktop.
Vapor 3 with Swift 5.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentMySQL | |
/* | |
Starting with Swift 5.2 the compiler is not able to resolve this automatically: | |
`migrations.add(model: Todo.self, database: .mysql)` | |
See: https://forums.swift.org/t/vapor-3-swift-5-2-regression/34764 | |
Instead of adding this to each model, I added these extensions. | |
*/ | |
extension MySQLModel { | |
typealias Database = MySQLDatabase | |
} | |
extension MySQLUUIDModel { | |
typealias Database = MySQLDatabase | |
} | |
extension MySQLStringModel { | |
typealias Database = MySQLDatabase | |
} | |
extension MySQLPivot { | |
typealias Database = MySQLDatabase | |
} | |
extension MySQLUUIDPivot { | |
typealias Database = MySQLDatabase | |
} | |
extension MySQLStringPivot { | |
typealias Database = MySQLDatabase | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentPostgreSQL | |
/* | |
Starting with Swift 5.2 the compiler is not able to resolve this automatically: | |
`migrations.add(model: Todo.self, database: .psql)` | |
See: https://forums.swift.org/t/vapor-3-swift-5-2-regression/34764 | |
Instead of adding this to each model, I added these extensions. | |
*/ | |
extension PostgreSQLModel { | |
typealias Database = PostgreSQLDatabase | |
} | |
extension PostgreSQLUUIDModel { | |
typealias Database = PostgreSQLDatabase | |
} | |
extension PostgreSQLStringModel { | |
typealias Database = PostgreSQLDatabase | |
} | |
extension PostgreSQLPivot { | |
typealias Database = PostgreSQLDatabase | |
} | |
extension PostgreSQLUUIDPivot { | |
typealias Database = PostgreSQLDatabase | |
} | |
extension PostgreSQLStringPivot { | |
typealias Database = PostgreSQLDatabase | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentSQLite | |
/* | |
Starting with Swift 5.2 the compiler is not able to resolve this automatically: | |
`migrations.add(model: Todo.self, database: .sqlite)` | |
See: https://forums.swift.org/t/vapor-3-swift-5-2-regression/34764 | |
Instead of adding this to each model, I added these extensions. | |
*/ | |
extension SQLiteModel { | |
typealias Database = SQLiteDatabase | |
} | |
extension SQLiteUUIDModel { | |
typealias Database = SQLiteDatabase | |
} | |
extension SQLiteStringModel { | |
typealias Database = SQLiteDatabase | |
} | |
extension SQLitePivot { | |
typealias Database = SQLiteDatabase | |
} | |
extension SQLiteUUIDPivot { | |
typealias Database = SQLiteDatabase | |
} | |
extension SQLiteStringPivot { | |
typealias Database = SQLiteDatabase | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment