IndexedDB is deleting data when a PK is shared amongst two objectStores
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Oct 2014 21:00:58 +0000 (21:00 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Oct 2014 21:00:58 +0000 (21:00 +0000)
commit2e8f55300315d49c7c226547731c8dd8ceb084a7
tree6b33169f9faba6e011f0f7aee48816869725f259
parentf2d3ed5c20eae9d32c17ee5965c83916340acfa8
IndexedDB is deleting data when a PK is shared amongst two objectStores
rdar://problem/18479306 and https://bugs.webkit.org/show_bug.cgi?id=137154

Reviewed by Jer Noble.

Source/WebKit2:

* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::v1RecordsTableSchema): Store away the v1 schema for introspection into the database.
(WebKit::v2RecordsTableSchema): Add utility methods to get the v2 schema with different Table names.
(WebKit::createOrMigrateRecordsTableIfNecessary): Check to see if the Records table exists with
  the correct schema. If it is the v1 schema, then migrate the data to a new v2 table, drop the v1
  table, then slide the new table into place.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::ensureValidRecordsTable): Make sure the Records table
  exists and is v2, and then make sure the uniqueness index exists.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata): Don’t bother creating
  the Records table here as it will have already been established earlier.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::getOrEstablishMetadata):
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:

LayoutTests:

* storage/indexeddb/primary-key-unique-to-objectstore-expected.txt: Added.
* storage/indexeddb/primary-key-unique-to-objectstore.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/primary-key-unique-to-objectstore-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/primary-key-unique-to-objectstore.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h