@mikebronnersave(on:) returns a future (since it needs to wait for the save to return from the DB) so you need to unwrap wrap. Is there any particular reason why youâre saving the marker again? Youâre effectively getting the marker from the database and then saving it again with no changes. Youâre also throwing away the result of the save on the pivot - if that fails you wouldnât know about it. I would write it with:
Hello. When creating the first Pivot of the course you will be asked to create a protocol, but I am in trouble understanding how to fix it. In this case, what will be added and the error will be resolved?
import Foundation
import Vapor
import FluentSQLite
final class AcronymCategoryPivot:SQLiteUUIDPivot {
var id:UUID?
var acronymID:Acronym.ID
var categoryID :Category.ID
typealias Left = Acronym
typealias Right = Category
static let leftIDKey: LeftIDKey = \AcronymCategoryPivot.acronymID
static let rightIDkey:RightIDKey = \AcronymCategoryPivot.categoryID
init(_ acronymID:Acronym.ID, _ categoryID:Category.ID) {
self.acronymID = acronymID
self.categoryID = categoryID
}
}
extension AcronymCategoryPivot:Migration {}
Ah Iâve spotted the issue! In your original declaration you have a rightIDkey variable - note the lower case k in key - it should be an upper case K!
Can someone elaborate a little on âswitch to using MySQLâ for the people whoâve never done web development before? Isnât as straight forward as swapping import statementsâŠ
For the basic stuff you change your dependencies to bring in MySQL, change the import statements and then change your SQLiteModels to MySQLModels. If youâre doing anything custom, youâll need to migrate that as well