title: CoreData migration issues
body: <p>I am currently writing the next version of an app.</p>
  
  <p>In the Old version, there was no CoreData sqlite</p>
  
  <p>In the New version, we have a local CoreData sqlite database.</p>
  
  <p>When I install the new version of the application from scratch, there is no problems, the store is there and I can query.</p>
  
  <p>However, when I install the app on phone that has the previous version on it, my queries come back with no results.</p>
  
  <p>When I look at the logs, there is nothing in the console, and no errors are returned.</p>
  
  <pre><code>   #import "CoreDataHelper.h"
  
  @implementation CoreDataHelper
  @synthesize store = _store;
  @synthesize coordinator = _coordinator;
  
  
  #pragma mark - 
  #pragma mark - FILES
  NSString *storeFileName = @"Reporting.sqlite";
  
  #pragma mark - 
  #pragma mark - PATHS
  - (NSString *)applicationDocumentsDirectory {
  
      return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
  
  }
  
  - (NSURL *)applicationStoresDirectory {
  
      NSURL *storesDirectory = [[NSURL fileURLWithPath:[self applicationDocumentsDirectory]]URLByAppendingPathComponent:@"Stores"];
  
      NSFileManager *fileManager = [NSFileManager defaultManager];
  
      if (![fileManager fileExistsAtPath:[storesDirectory path]]) {
          NSError *error = nil;
          if ([fileManager createDirectoryAtURL:storesDirectory
                     withIntermediateDirectories:YES
                                      attributes:nil
                                           error:&amp;error]) {
              //File created
          } else {
  
              //Error
          }
      }
  
      return storesDirectory;
  
  }
  
  - (NSURL *)storeURL {
  
      return [[self applicationStoresDirectory] URLByAppendingPathComponent:storeFileName];
  
  }
  
  #pragma mark - 
  #pragma mark - SETUP
  - (id)init {
  
      if (self = [super init]) {
          _model = [NSManagedObjectModel mergedModelFromBundles:nil];
          _coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:_model];
          _context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
          [_context setPersistentStoreCoordinator:_coordinator];
      }
  
      return self;
  }
  
  - (void)loadStore {
  
      if (_store) return; // Don't load store if it is already loaded
  
      // to generate the database in the app launching comment next lines...
  
      if(![self getFileExistence:storeFileName]){
          // file URL in our bundle
          NSURL *fileFromBundle = [[NSBundle mainBundle]URLForResource:@"FaultReporting" withExtension:@"sqlite"];
  
          // Destination URL
          NSURL *destinationURL = [[self applicationStoresDirectory] URLByAppendingPathComponent:@"FaultReporting.sqlite"];
  
          // copy it over
          [[NSFileManager defaultManager]copyItemAtURL:fileFromBundle toURL:destinationURL error:nil];
      }
  
      // end of comments
  
      NSError *error = nil;
  
      @try {
          _store = [_coordinator addPersistentStoreWithType:NSSQLiteStoreType
                                              configuration:nil
                                                        URL:[self storeURL]
                                                    options:@{                                                         NSMigratePersistentStoresAutomaticallyOption: @(YES),
                                                              NSInferMappingModelAutomaticallyOption: @(YES)}
                                                      error:&amp;error];
      }
      @catch (NSException *exception) {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Error: %@, %@",error, [error userInfo]] delegate:self
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil, nil];
          [alert show];
      }
      @finally {
          //
      }
  
  }
  </code></pre>