Update schema to fix uniqueness problems

This commit is contained in:
Ben Turner 2010-05-28 18:41:52 -07:00
parent 4704162c1a
commit f8776516fc
3 changed files with 7 additions and 11 deletions

View File

@ -122,8 +122,6 @@ CreateTables(mozIStorageConnection* aDBConn)
"name TEXT NOT NULL, "
"key_path TEXT NOT NULL, "
"auto_increment INTEGER NOT NULL DEFAULT 0, "
"readers INTEGER NOT NULL DEFAULT 0, "
"is_writing INTEGER NOT NULL DEFAULT 1, "
"PRIMARY KEY (id), "
"UNIQUE (name)"
");"
@ -136,7 +134,7 @@ CreateTables(mozIStorageConnection* aDBConn)
"id INTEGER, "
"object_store_id INTEGER NOT NULL, "
"data TEXT NOT NULL, "
"key_value TEXT DEFAULT NULL, "
"key_value TEXT DEFAULT NULL UNIQUE, "
"PRIMARY KEY (id), "
"FOREIGN KEY (object_store_id) REFERENCES object_store(id) ON DELETE "
"CASCADE"
@ -153,10 +151,9 @@ CreateTables(mozIStorageConnection* aDBConn)
// Table `ai_object_data`
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE TABLE ai_object_data ("
"id INTEGER, "
"id INTEGER PRIMARY KEY, "
"object_store_id INTEGER NOT NULL, "
"data TEXT NOT NULL, "
"PRIMARY KEY (id), "
"FOREIGN KEY (object_store_id) REFERENCES object_store(id) ON DELETE "
"CASCADE"
");"

View File

@ -36,10 +36,12 @@
request.onsuccess = grabEventAndContinueHandler;
event = yield;
is(event.result, key, "Correct key");
request = objectStore.add({}, key);
request.onerror = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
event = yield;
yield;
finishTest();
yield;

View File

@ -178,13 +178,10 @@
is(event.result, key1, "addOrModify gave back the same key");
/*
// XXXbent this should work, but doesn't...
request = objectStore.add({id:10});
request.onerror = grabEventAndContinueHandler;
request.onsuccess = errorHandler;
event = yield;
*/
request.onsuccess = unexpectedSuccessHandler;
yield;
request = db.createObjectStore("bazing", "id", true);
request.onerror = errorHandler;