![]() Failure-safe nested transactions with batch processing optimizations.Drop-in replacement for HTML5 SQL API, the only change should be window.openDatabase() -> sqlitePlugin.openDatabase().Fixes to work with PouchDB by Works with Cordova 3.x tooling and available at PhoneGap build.Pre-populated databases support for Android & iOS is now integrated, usage described below.New openDatabase and deleteDatabase location option to select database location (iOS only) and disable iCloud backup.SQLCipher for Android & iOS is now supported by brodysoft / Cordova-sqlcipher-adaptor.Windows (8.1) version is added, using the C++ SQLite-WinRT library.Not all Windows targets are supported by automatic installation.Visual C++ build support for Windows Phone 8.1 will be added later. Visual C++ build file is provided for Windows 8.1 only.Cannot be tested by existing QUnit test suite in test. ![]() ![]() Very limited testing: tests are in simple-test-windows.Database close and delete operations not yet implemented.Windows (8.1) version is in experimental state:.License for Android, WP(8), and Windows (8.1) versions: MIT or Apache 2.0 Trans.Native interface to sqlite in a Cordova/PhoneGap plugin for Android, iOS, WP(8/8.1), and Windows (8.1), with API similar to HTML5/ Web SQL API. finally, after all initial seeding of the db, start our migrations This will go at the bottom of our seedDb function so that we can pass in the same transaction it is using - this way if any part of the script fails, there's a full transaction rollback. Let's kick off the migrations by checking what our user_version is, and then running the migration at that index, if there is one. incremented by 1 as each migration completes). This is where the user_version can help us - it defaults to 0, the first index in a javascript array, and can be updated to any integer we need ( i.e. A very clean way to do this is to use the array's indexes as our guideposts. We need a way to track which migrations have already ran vs those that have not. Notice that our migrations variable is an array - this is important. Let's create a variable to hold our migrations in the same file that houses our seedDb function: //widgits.js A better approach is to batch up your changes into what are called migrations - essentially self-contained chunks of changes that should only be ran one time, and for a very specific purpose. as time goes by and features are added? We could probably get by with parsing the table_info, another PRAGMA command, to perform logic such as if column 'x' exists, rename to column 'y', but that could get clunky and unmanageable very quickly. But, what happens if we need to add/update columns, migrate data, etc. One piece of metadata in particular, user_version, is what we'll use for this.Īs you may recall from the Getting Started tutorial, we have all of our db initialization in a seedDb function. Coming from MSSQL background, as far as databases go, I'd not heard of these PRAGMA commands, so I am happy to have essentially stumbled upon the documentation for them when looking for info on sqlite migration techniques. In sqlite, there are special commands you can execute to get or set some metadata about a database. ![]() This plan builds off of what we covered in the getting started tutorial mentioned above, so you may want to read through it first to have the context. and it took me a bit to get a decent plan in place. As I've been working on a hybrid mobile app (more about that coming very soon!), I've found that it is not exactly straightforward how to gracefully handle database migrations. September 25th, 2015 Cordova Sqlite MigrationsĪ while back, I wrote a post on Getting started with Cordova Sqlite. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |