The below migration that was working in Postgress, but failing in SQLite. @vzsg helped me figure out that the issue is that multiple ADDs are not supported by SQLite.
public struct Employer_AddDefaultContributions: Preparation {
public static func prepare(_ database: Database) throws {
try database.modify(Employer.entity) { employer in
employer.double("default_onetime_contribution", optional: true)
employer.double("default_monthly_contribution", optional: true)
}
}
public static func revert(_ database: Database) throws { }
}
This results in a cryptic error: prepare("near \",\": syntax error"), caused by the following invalid SQLite query:
ALTER TABLE `employers` ADD `default_onetime_contribution` DOUBLE, ADD `default_monthly_contribution` DOUBLE
This can be worked around by splitting up the modify, but this is non-intuitive and should be fixed IMHO.
public struct Employer_AddDefaultContributions: Preparation {
public static func prepare(_ database: Database) throws {
// has to be split up until sqlite bug is fixed
try database.modify(Employer.entity) { employer in
employer.double("default_onetime_contribution", optional: true)
}
try database.modify(Employer.entity) { employer in
employer.double("default_monthly_contribution", optional: true)
}
}
public static func revert(_ database: Database) throws { }
}
The below migration that was working in Postgress, but failing in SQLite. @vzsg helped me figure out that the issue is that multiple
ADD
s are not supported by SQLite.This results in a cryptic error:
prepare("near \",\": syntax error")
, caused by the following invalid SQLite query:This can be worked around by splitting up the modify, but this is non-intuitive and should be fixed IMHO.