Bug 1386052: Correct PageMetadata.HISTORY_GUID foreign key. r=grisha
This change is fixing an issue unrelated to this bug.
It was using Visits.HISTORY_GUID, which is not in the table and thus doesn't
make sense for the first clause of the foreign key constraint. Visits & its
replacement have the same value so the behavior should not change.
MozReview-Commit-ID: 8EbJh586DN3
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
@@ -221,17 +221,17 @@ public final class BrowserDatabaseHelper
debug("Creating " + TABLE_PAGE_METADATA + " table");
db.execSQL("CREATE TABLE " + TABLE_PAGE_METADATA + "(" +
PageMetadata._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
PageMetadata.HISTORY_GUID + " TEXT NOT NULL," +
PageMetadata.DATE_CREATED + " INTEGER NOT NULL, " +
PageMetadata.HAS_IMAGE + " TINYINT NOT NULL DEFAULT 0, " +
PageMetadata.JSON + " TEXT NOT NULL, " +
- "FOREIGN KEY (" + Visits.HISTORY_GUID + ") REFERENCES " +
+ "FOREIGN KEY (" + PageMetadata.HISTORY_GUID + ") REFERENCES " +
TABLE_HISTORY + "(" + History.GUID + ") ON DELETE CASCADE ON UPDATE CASCADE" +
");");
// Establish a 1-to-1 relationship with History table.
db.execSQL("CREATE UNIQUE INDEX page_metadata_history_guid ON " + TABLE_PAGE_METADATA + "("
+ PageMetadata.HISTORY_GUID + ")");
// Improve performance of commonly occurring selections.
db.execSQL("CREATE INDEX page_metadata_history_guid_and_has_image ON " + TABLE_PAGE_METADATA + "("