(#5519) - remove sqlite plugin support (BREAKING)
diff --git a/docs/_includes/api/create_database.html b/docs/_includes/api/create_database.html
index f173a84..60a90d3 100644
--- a/docs/_includes/api/create_database.html
+++ b/docs/_includes/api/create_database.html
@@ -33,23 +33,14 @@
 
 * `size`: Amount in MB to request for storage, which you will need if you are storing >5MB in order to [avoid storage limit errors on iOS/Safari](/errors.html#not_enough_space). Persistent views use a seperate database per view which will also request storage space so keep in mind the upper storage limits when using persistent views on iOS.
 
-**SQLite Plugin-only options:**
-
-Any options given to the PouchDB constructor will be passed verbatim to the SQLite Plugin.  Older versions of PouchDB supported only the following, which may be of use:
-
-* `location`: Where to store data on iOS, which may affect iTunes/iCloud backup, and thus whether or not your app gets rejected by Apple. See [SQLite Plugin documentation](https://github.com/brodysoft/Cordova-SQLitePlugin/#opening-a-database) and [iOS data storage guidelines](https://developer.apple.com/icloud/documentation/data-storage/index.html).
-* `createFromLocation`: Use a pre-populated database, so you can package it with your app and users don't have to wait for it to load. See the [SQLite Plugin documentation](https://github.com/brodysoft/Cordova-SQLitePlugin/#pre-populated-database).
-* `androidDatabaseImplementation`: `1` to use the new `sqlite4java` implementation, `2` to use the older version based on the native Android APIs. Defaults to `1`. See the [SQLite Plugin documentation](https://github.com/litehelpers/Cordova-sqlite-storage#android-sqlite-implementation).
-
 **Notes:**
 
 1. In IndexedDB and WebSQL, PouchDB will use `_pouch_` to prefix the internal database names. Do not manually create databases with the same prefix.
 2. When acting as a client on Node, any other options given will be passed to [request][].
-3. When using the `'leveldb'` adapter (the default on Node), any other options given will be passed to [levelup][]. The storage layer of leveldb can be replaced by passing a level backend factory (such as [MemDOWN][]) as `options.db`. The rest of the [supported levelup options are documented here][levelup_options].
+3. When using the `'leveldb'` adapter (the default on Node), any other options given will be passed to [levelup][].
 
 [request]: https://github.com/mikeal/request
 [levelup]: https://github.com/rvagg/node-levelup
-[MemDOWN]: https://github.com/rvagg/memdown
 [levelup_options]: https://github.com/rvagg/node-levelup/#options
 
 #### Example Usage:
@@ -59,18 +50,16 @@
 var db = new PouchDB('http://localhost:5984/dbname');
 {% endhighlight %}
 
-Create a WebSQL-only Pouch (e.g. when using the [SQLite Plugin][] for Cordova/PhoneGap):
-
-[sqlite plugin]: https://github.com/brodysoft/Cordova-SQLitePlugin
+Create a PouchDB that explicitly uses WebSQL:
 
 {% highlight js %}
 var db = new PouchDB('dbname', {adapter : 'websql'});
 {% endhighlight %}
 
-Create an in-memory Pouch (in Node):
+Create an in-memory Pouch (must install `pouchdb-adapter-memory` first):
 
 {% highlight js %}
-var db = new PouchDB('dbname', {db : require('memdown')});
+var db = new PouchDB('dbname', {adapter: 'memory'});
 {% endhighlight %}
 
 Create a remote PouchDB with special Ajax options:
diff --git a/docs/adapters.md b/docs/adapters.md
index 6a263c5..279877e 100644
--- a/docs/adapters.md
+++ b/docs/adapters.md
@@ -120,48 +120,35 @@
 console.log(pouch.adapter); // prints either 'idb' or 'websql'
 ```
 
-
 ### SQLite plugin for Cordova/PhoneGap
 
-On Cordova/PhoneGap, the native SQLite database is often a popular choice, because it allows unlimited storage (compared to [IndexedDB/WebSQL storage limits](http://www.html5rocks.com/en/tutorials/offline/quota-research)). It also offers more flexibility in backing up and pre-loading databases, because the SQLite files are directly accessible to app developers.
+On Cordova/PhoneGap/Ionic, the native SQLite database is often a popular choice, because it allows unlimited storage (compared to [IndexedDB/WebSQL storage limits](http://www.html5rocks.com/en/tutorials/offline/quota-research)). It also offers more flexibility in backing up and pre-loading databases, because the SQLite files are directly accessible to app developers.
 
-Luckily, there is a [SQLite Plugin][] (also known as SQLite Storage) that accomplishes exactly this.  If you include this plugin in your project, then PouchDB will automatically pick it up based on the `window.sqlitePlugin` object.
+There are various Cordova plugins that can provide access to native SQLite, such as 
+[Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage),    
+[cordova-plugin-sqlite-2](https://github.com/nolanlawson/cordova-plugin-sqlite-2), or 
+[cordova-plugin-websql](https://github.com/Microsoft/cordova-plugin-websql).
 
-However, this only occurs if the adapter is `'websql'`, not `'idb'` (e.g. on Android 4.4+).  To force PouchDB to use the WebSQL adapter, you can do:
+To use them, you must install them separately into your Cordova application, and then add a special third-party PouchDB adapter
+called [pouchdb-adapter-cordova-sqlite](https://github.com/nolanlawson/pouchdb-adapter-cordova-sqlite). Once you do
+that, you can use it via:
 
 ```js
-var db = new PouchDB('myDB', {adapter: 'websql'});
+var db = new PouchDB('myDB.db', {adapter: 'cordova-sqlite'});
 ```
 
-Note that a recent change to Cordova SQLite Plugin requires the `location` or `iosDatabaseLocation` parameters in the openDatabase and deleteDatabase calls (the second is preferred - see [SQLite Plugin][] for details). In PouchDB, all given options are passed through to the SQLite plugin, so you can pass this param like so:
+{% include alert/start.html variant="info"%}
+In PouchDB pre-6.0.0, Cordova SQLite support was available out-of-the-box, but it has been moved to a separate plugin
+to reduce confusion and to make it explicit whether you are using WebSQL or Cordova SQLite.
+{% include alert/end.html%}
 
-```js
-var db = new PouchDB('myDB', {adapter: 'websql', iosDatabaseLocation: 'default'});
-```
-
-
-If you are unsure whether PouchDB is using the SQLite Plugin or not, just run:
-
-```js
-db.info().then(console.log.bind(console));
-```
-
-This will print some database information, including the attribute `sqlite_plugin`, which will be `true` if the SQLite Plugin is being used.
-
-{% include alert/start.html variant="warning"%}
-{% markdown %}
-
-The SQLite Plugin does not currently pass the PouchDB test suite. It also tends to be slower than direct IndexedDB/WebSQL.
-
-We recommend avoiding the SQLite Plugin, unless you are hitting the 50MB storage limit in iOS or you require native or preloaded access to the database files.
+We recommend avoiding Cordova SQLite unless you are hitting the 50MB storage limit in iOS, you 
+require native or preloaded access to the database files, or there's some other reason to go native.
+The built-in IndexedDB and WebSQL adapters are nearly always more performant and stable.
 
 {% endmarkdown %}
 {% include alert/end.html%}
 
-### Cordova SQLite Plugin 2
-
-There is now a rewrite of the SQLite Plugin available, appropriately named [SQLite Plugin 2][], which should be a drop-in replacement for the SQLite Plugin.  We recommend preferring the [SQLite Plugin 2][] over the original, because it passes the PouchDB test suite on both iOS and Android.  Note that the rewrite does not require the `location` or `iosDatabaseLocation` parameter, as the SQLite Plugin does.
-
 ### Browser adapter plugins
 
 PouchDB also offers separate browser plugins that use backends other than IndexedDB and WebSQL. These plugins fully pass the PouchDB test suite and are rigorously tested in our CI process.
diff --git a/packages/pouchdb-adapter-websql-core/src/index.js b/packages/pouchdb-adapter-websql-core/src/index.js
index 4cea838..dd2f3dd 100644
--- a/packages/pouchdb-adapter-websql-core/src/index.js
+++ b/packages/pouchdb-adapter-websql-core/src/index.js
@@ -548,8 +548,6 @@
           callback(null, {
             doc_count: docCount,
             update_seq: updateSeq,
-            // for debugging
-            sqlite_plugin: db._sqlitePlugin,
             websql_encoding: encoding
           });
         });
diff --git a/packages/pouchdb-adapter-websql-core/src/openDatabase.js b/packages/pouchdb-adapter-websql-core/src/openDatabase.js
index 28b5edf..6f5b98a 100644
--- a/packages/pouchdb-adapter-websql-core/src/openDatabase.js
+++ b/packages/pouchdb-adapter-websql-core/src/openDatabase.js
@@ -26,9 +26,6 @@
   if (!cachedResult) {
     cachedResult = openDBSafely(opts);
     cachedDatabases.set(opts.name, cachedResult);
-    if (cachedResult.db) {
-      cachedResult.db._sqlitePlugin = typeof sqlitePlugin !== 'undefined';
-    }
   }
   return cachedResult;
 }
diff --git a/packages/pouchdb-adapter-websql/src/index.js b/packages/pouchdb-adapter-websql/src/index.js
index 6260d34..d619e00 100644
--- a/packages/pouchdb-adapter-websql/src/index.js
+++ b/packages/pouchdb-adapter-websql/src/index.js
@@ -1,45 +1,17 @@
 import WebSqlPouchCore from 'pouchdb-adapter-websql-core';
 import { extend } from 'js-extend';
-import { guardedConsole } from 'pouchdb-utils';
-import { valid, validWithoutCheckingCordova } from './validation';
+import valid from './valid';
 
-function createOpenDBFunction(opts) {
-  return function (name, version, description, size) {
-    if (typeof sqlitePlugin !== 'undefined') {
-      // The SQLite Plugin started deviating pretty heavily from the
-      // standard openDatabase() function, as they started adding more features.
-      // It's better to just use their "new" format and pass in a big ol'
-      // options object. Also there are many options here that may come from
-      // the PouchDB constructor, so we have to grab those.
-      var sqlitePluginOpts = extend({}, opts, {
-        name: name,
-        version: version,
-        description: description,
-        size: size
-      });
-      return sqlitePlugin.openDatabase(sqlitePluginOpts);
-    }
-
-    // Traditional WebSQL API
-    return openDatabase(name, version, description, size);
-  };
+function openDB(name, version, description, size) {
+  // Traditional WebSQL API
+  return openDatabase(name, version, description, size);
 }
 
 function WebSQLPouch(opts, callback) {
-  var websql = createOpenDBFunction(opts);
   var _opts = extend({
-    websql: websql
+    websql: openDB
   }, opts);
 
-  if (typeof cordova !== 'undefined' && !validWithoutCheckingCordova()) {
-    guardedConsole('error',
-      'PouchDB error: you must install a SQLite plugin ' +
-      'in order for PouchDB to work on this platform. Options:' +
-      '\n - https://github.com/nolanlawson/cordova-plugin-sqlite-2' +
-      '\n - https://github.com/litehelpers/Cordova-sqlite-storage' +
-      '\n - https://github.com/Microsoft/cordova-plugin-websql');
-  }
-
   WebSqlPouchCore.call(this, _opts, callback);
 }
 
diff --git a/packages/pouchdb-adapter-websql/src/validation.js b/packages/pouchdb-adapter-websql/src/valid.js
similarity index 70%
rename from packages/pouchdb-adapter-websql/src/validation.js
rename to packages/pouchdb-adapter-websql/src/valid.js
index 4b4fe38..6f19c32 100644
--- a/packages/pouchdb-adapter-websql/src/validation.js
+++ b/packages/pouchdb-adapter-websql/src/valid.js
@@ -49,32 +49,11 @@
   return openedTestDB;
 }
 
-function validWithoutCheckingCordova() {
-  if (typeof openDatabase === 'undefined') {
+function valid() {
+  if (typeof openDatabase !== 'function') {
     return false;
   }
-  if (typeof sqlitePlugin !== 'undefined') {
-    // Both sqlite-storage and SQLite Plugin 2 create this global object,
-    // which we can check for to determine validity. It should be defined
-    // after the 'deviceready' event.
-    return true;
-  }
   return isValidWebSQL();
 }
 
-function valid() {
-  // The Cordova SQLite Plugin and SQLite Plugin 2 can be used in cordova apps,
-  // and we can't know whether or not the plugin was loaded until after the
-  // 'deviceready' event. Since it's impractical for us to wait for that event
-  // before returning true/false for valid(), we just return true here
-  // and notify the user that they may need a plugin.
-  if (typeof cordova !== 'undefined') {
-    return true;
-  }
-  return validWithoutCheckingCordova();
-}
-
-export {
-  valid,
-  validWithoutCheckingCordova
-};
+export default valid;
\ No newline at end of file
diff --git a/tests/integration/browser.info.js b/tests/integration/browser.info.js
index 7640467..b4ea03c 100644
--- a/tests/integration/browser.info.js
+++ b/tests/integration/browser.info.js
@@ -21,7 +21,6 @@
       return db.info().then(function (info) {
         switch (db.adapter) {
           case 'websql':
-            info.sqlite_plugin.should.be.a('boolean');
             info.websql_encoding.should.be.a('string');
             info.adapter.should.equal('websql');
             break;
diff --git a/tests/integration/browser.sqlite.js b/tests/integration/browser.sqlite.js
deleted file mode 100644
index 126f375..0000000
--- a/tests/integration/browser.sqlite.js
+++ /dev/null
@@ -1,63 +0,0 @@
-'use strict';
-
-// mock tests for the Cordova SQLite Plugin
-describe('browser.sqlite.js', function () {
-
-  var dbs = {};
-
-  var called = false;
-
-  // Just verify that we're calling the SQLite Plugin with its
-  // weird non-standard API
-  var sqlitePlugin = {
-    openDatabase: function (opts) {
-      called = true;
-      should.exist(opts.location);
-      should.exist(opts.name);
-      should.exist(opts.version);
-      should.exist(opts.description);
-      should.exist(opts.size);
-      should.exist(opts.weirdCustomOption);
-      return openDatabase(opts.name, opts.version, opts.description, opts.size);
-    }
-  };
-
-  beforeEach(function (done) {
-    window.sqlitePlugin = sqlitePlugin;
-    dbs.name = testUtils.adapterUrl('local', 'testdb');
-    testUtils.cleanup([dbs.name], done);
-  });
-
-  after(function (done) {
-    delete window.sqlitePlugin;
-    testUtils.cleanup([dbs.name], done);
-  });
-
-  it('calls window.sqlitePlugin correctly', function () {
-    if (typeof openDatabase !== 'function') {
-      return; // skip in non-websql browsers
-    }
-
-    var db;
-    try {
-      db = new PouchDB(dbs.name + '_sqlite', {
-        adapter: 'websql',
-        location: 'yolo',
-        weirdCustomOption: 'foobar'
-      });
-    } catch (err) {
-      if (/Invalid Adapter/.test(err.message)) {
-        return testUtils.Promise.resolve();
-      } else {
-        throw err;
-      }
-    }
-
-    return db.info().then(function (info) {
-      called.should.equal(true);
-      info.doc_count.should.equal(0);
-    }).then(function () {
-      return db.destroy();
-    });
-  });
-});
diff --git a/tests/integration/index.html b/tests/integration/index.html
index d8c17b1..e165681 100644
--- a/tests/integration/index.html
+++ b/tests/integration/index.html
@@ -59,7 +59,6 @@
     <script src='test.reserved.js'></script>
     <script src='test.prefix.js'></script>
     <script src='browser.worker.js'></script>
-    <script src='browser.sqlite.js'></script>
     <script type="text/javascript" src="./webrunner.js"></script>
   </body>
 </html>