Thank you for your response. I had actually read that post in depth before posting here. What I would really like to know is, am I doing anything wrong with my VersionedSchema, ModelContainer or @Models please? I have been looking all around and it is hard to find the right answer for my specific case where I have transitioned to a Versioned Schema where I have suddenly placed all my @Models in, and have also changed my ModelContainer. I actually initially built this new container like so as I thought this was correct for migration plans:
actor ModelContainerActor {
@MainActor
static func container() -> ModelContainer {
let schema = Schema(
versionedSchema: AllSwiftDataSchemaV3.self
)
let configuration = ModelConfiguration()
let container = try! ModelContainer(
for: schema,
migrationPlan: PlanBriefMigrationPlan.self,
configurations: configuration
)
return container
}
}
Which I believe may have been causing the crashes. I haven't had any crashes in the last 24 hours since changing to this container:
var sharedModelContainer: ModelContainer = {
let schema = Schema(
[
SDPlanBrief.self,
SDAirport.self,
SDChart.self,
SDIndividualRunwayAirport.self,
SDLocationBrief.self
]
)
let configuration = ModelConfiguration()
do {
return try ModelContainer(for: schema,
migrationPlan: PlanBriefMigrationPlan.self,
configurations: configuration)
} catch {
fatalError("error = \(error.localizedDescription)")
}
}()
Your advice/analysis would be greatly appreciated, thank you so much.