iOS SQLite.swift, regarding upgrade of app?

Regarding the magnificent and amazing SQLite.swift, I’m wondering

You have an app in the app store, v7. There’s an upgrade to v8. User X does upgrade v7 to v8 using the app store.

  • On a UILongPressGestureRecognizer how do I detect which object generated the event?
  • Can't use #define for convenience
  • AVAudioPlayer produces lag despite prepareToPlay() in Swift
  • Set UIImageView Size in UITableViewCell when UIImage loaded from URL?
  • Passing Data From iPhone app to PHP file
  • CFBundleShortVersionString must be a period-separated list of most three non-negative integers
  • Say in v8, we have slightly changed one of the sql tables, perhaps add a column or rename a column.

    Should anything or must anything special be done in SQLite.swift in this case?

    What’s the SQLite.swift way to handle that?

    (In for example, Android there’s a handy onUpgrade concept in their helper class … which comes with it’s own set of complex issues.)

    Solutions Collect From Internet About “iOS SQLite.swift, regarding upgrade of app?”

    The implementation of SQLiteOpenHelper is quite simple:

            db = SQLiteDatabase.openDatabase(...);
    
            onConfigure(db);
    
            int version = db.getVersion();
            if (version != mNewVersion) {
                db.beginTransaction();
                try {
                    if (version == 0) {
                        onCreate(db);
                    } else {
                        if (version > mNewVersion) {
                            onDowngrade(db, version, mNewVersion);
                        } else {
                            onUpgrade(db, version, mNewVersion);
                        }
                    }
                    db.setVersion(mNewVersion);
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                }
            }
    

    Just do the same in Swift.

    For how to implement onUpgrade(), see SQLiteOpenHelper onUpgrade() Confusion Android.