I'm trying to add two more data models SectionsSD andArticles SD to an existing project using SwiftData where I had one model and am running into a variety of CoreData errors when I try to run my app. I am running Xcode 15.2 and the latest iOS simulator at iOS 17.2
Here is my container
let container: ModelContainer = {
let schema = Schema([
LocationData.self,
SectionsSD.self,
ArticlesSD.self
])
let container = try! ModelContainer(for: schema, configurations: [])
return container
}()
After I add these two models I get the following errors and I can't load data into the SectionsSD and ArticlesSD models. If I comment out my LocataionData model that works w/o error or if I run just LocationData it runs without error but run all together and I get the following errors in the log:
error: Error: Persistent History (11) has to be truncated due to the following entities being removed: (
SectionsSD,
ArticlesSD
)
CoreData: error: Error: Persistent History (11) has to be truncated due to the following entities being removed: (
SectionsSD,
ArticlesSD
)
warning: Warning: Dropping Indexes for Persistent History
CoreData: warning: Warning: Dropping Indexes for Persistent History
warning: Warning: Dropping Transactions prior to 11 for Persistent History
CoreData: warning: Warning: Dropping Transactions prior to 11 for Persistent History
warning: Warning: Dropping Changes prior to TransactionID 11 for Persistent History
Any advice here would be appreciated. These are initial models so migration is not really a need yet. Seems to just **** if you add more models.