I'm adding a new migration:
migrator.registerMigration("1.0.1") { db in
try db.alter(table: "mbyuser", body: { t in
t.add(column: "username", .text)
t.add(column: "mobileNumber", .text)
})
}
But I'm getting a crash at startup:
2023-07-24 22:01:08.636110-0500 Markably[65066:442647] [logging] table mbyUser has no column named username in "INSERT INTO "mbyUser" ("id", "avatar", "email", "username", "mobileNumber", "isAdmin", "isDeleted", "isOnboarded", "isPermanentlyDeleted", "clientPreferences", "gender", "birthdate", "isSubscribedToMarketingNotifications", "billingSubscriptionStripe", "billingSubscriptionStorekit", "isSuspended", "firstName", "lastName", "seats", "tasks", "courseCodes", "insertedAt", "updatedAt", "confirmedAt") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
I'm not sure why this might be as I extend the MutablePersistableRecord with username
and mobileNumber
extension MbyUser: FetchableRecord, MutablePersistableRecord {
enum Columns {
static let id = Column("id")
static let avatar = Column("avatar")
static let email = Column("email")
static let username = Column("username")
static let mobileNumber = Column("mobileNumber")
...
Along with the corresponding class fields:
public struct MbyUser: Identifiable, Codable {
public var id: String
public var avatar: String?
public var email: String
public var username: String?
public var mobileNumber: String?
...
Any suggestions as to why I'm getting this startup crash?