Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:02:37+00:00 2026-06-11T02:02:37+00:00

NB! I have seen Core Data Migration – Table Already Exists , and it

  • 0

NB! I have seen Core Data Migration – Table Already Exists, and it did not solve my problem.

I’m trying to do a lightweight migration of my data model, and am getting a failure at this point:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                         [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
                         nil];
store = [self addPersistentStoreWithType:NSSQLiteStoreType configuration:nil
                    URL:url options:options error:&error];

The error message is:

2012-09-06 17:14:19.450 Selene[79064:c07] CoreData: error: (1) I/O error for database at /Users/colin/Library/Application Support/iPhone Simulator/5.1/Applications/E1638F38-B13A-4728-91CD-CC380E761544/Library/Application Support/Selene/.Selene.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3.  SQLite error code:1, 'table ZMEASUREMENT already exists'

The actual change to the data model is the addition of a single optional string column on a completely different table, ZCYCLE. So it makes no sense that it’s complaining about ZMEASUREMENT.

I’ve stepped through the core data instantiation, and the NSManagedObjectModel looks like it is loaded correctly (new version). The url is correct.

I’ve tried making Clean in xcode, Reset Contents and Settings… in iOS Simulator, regenerate a version-1 sqlite file from scratch (using Core Data), and then try migration to version-2 again — no dice. So it’s not that my sqlite file is corrupt somehow.

Is data model information stored anywhere else that my cleaning might have missed?

Is there any other way to debug what’s actually happening in the lightweight migration? I can’t find any information other than the “table already exists” error quoted above, which doesn’t make any sense to me. Whatever’s going on inside addPersistentStoreWithType: is opaque to me.

The only way I have found to get a migration to proceed is to rename the table Core Data is complaining about, ZMEASUREMENT, as part of the migration. This works for one(1) migration only, and then I have to rename the table again to do a second migration. I am really not ok with the idea of a table whose name has to change every time I alter my data model; surely Core Data is not this broken.

EDIT:
In case it helps, here’s the list of attributes for table ZMEASUREMENT. Is any of this weird?

@property (nonatomic) int epochDay;         // Integer32 indexed
// time as number of seconds since local midnight, to avoid time zone and DST issues
@property (nonatomic, strong) NSNumber *localTime;  // Integer32 optional

// stored in Kelvins, to force me to test temperature conversion code properly
@property (nonatomic, strong) NSNumber *temperatureK;   // Float optional
@property (nonatomic) BOOL excludeTemperature;      // Boolean default=NO
@property (nonatomic, strong) NSNumber *fluidCode;  // Integer16 optional
@property (nonatomic, strong) NSNumber *openingCode;    // Integer16 optional
@property (nonatomic, strong) NSNumber *positionCode;   // Integer16 optional
@property (nonatomic, strong) NSNumber *textureCode;    // Integer16 optional
@property (nonatomic, strong) NSNumber *rateCode;   // Integer16 optional
@property (nonatomic, strong) NSNumber *heightCode; // Integer16 optional
// try renaming the internal property to see if it helps lightweight migration
@property (nonatomic, strong) NSString *commentDPL; // String optional
@property (nonatomic, strong) NSString *comment;    /* derived property (alias for commentDPL) */
@property (nonatomic, strong) NSSet *notes;     // Optional to-many relationship to MeasurementNote

The only non-optional fields are epochDay and excludeTemperature.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:02:39+00:00Added an answer on June 11, 2026 at 2:02 am

    Okay, ultimately to solve my problem I had to delete my whole xcdatamodeld directory and regenerate the data model from scratch. I guess I had a corruption in there somehow? It seems to work now; fingers crossed. I’m not happy with this as a solution because it’s going to make me ask all my beta testers to trash their saved data and start again, but it seems to be the only thing I’ve got.

    If anyone has a better idea what exactly went wrong, I’d still love to hear it. My app is going to live and die on being reliable with saved data, and this “solution” of trashing everything and starting over would be a non-starter if I had any paying customers yet. Core Data is making me nervous right now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an attribute in a Core Data Managed Object that I'm trying to
I have a multi-threaded app that uses Core Data. I've been seeing a lot
I have setup Core Data for an iPhone app without an instance of NSFetchedResultsController.
I have recently been looking at Core Data for the iPhone and I have
Im using a Core Data model for my iPhone app. I have been looking
I have an Event database loaded into Core Data that has duplicate Event titles.
Myself and a co-worker have this issue - We have a core data model.
I'm having a lot of issues with trying to perform some core data operations
I'm developing an iOS application using Core Data. I want to have the persistent
I have the following entities in core data as shown in the figure below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.