diff options
author | Makoto Onuki <omakoto@google.com> | 2017-03-14 11:11:48 -0700 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2017-03-14 11:15:27 -0700 |
commit | 459639bbe313d2424fa27ece3d7511452ff7eac9 (patch) | |
tree | 029ff7100c2ebefae197dca0975b4e03cc207552 | |
parent | 6d6be558693ec480b281e6614894f22ca5161944 (diff) | |
download | ContactsProvider-459639bbe313d2424fa27ece3d7511452ff7eac9.tar.gz |
Add DB upgrade step to update the views
Bug: 36089513
Test: Manual test
Test: adb shell am instrument -w com.android.providers.contacts.tests
Change-Id: I755cf889c40530d53e3511841db67e4e296d3838
-rw-r--r-- | src/com/android/providers/contacts/ContactsDatabaseHelper.java | 7 | ||||
-rwxr-xr-x | tools/contacts-db-schema.sh | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index 57b3b549..07741deb 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -137,7 +137,7 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { * 1200-1299 O * </pre> */ - static final int DATABASE_VERSION = 1201; + static final int DATABASE_VERSION = 1202; private static final int MINIMUM_SUPPORTED_VERSION = 700; @VisibleForTesting @@ -2653,6 +2653,11 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { oldVersion = 1201; } + if (isUpgradeRequired(oldVersion, newVersion, 1202)) { + upgradeViewsAndTriggers = true; + oldVersion = 1202; + } + // We extracted "calls" and "voicemail_status" at this point, but we can't remove them here // yet, until CallLogDatabaseHelper moves the data. diff --git a/tools/contacts-db-schema.sh b/tools/contacts-db-schema.sh index 3aa164bc..c5778441 100755 --- a/tools/contacts-db-schema.sh +++ b/tools/contacts-db-schema.sh @@ -23,7 +23,7 @@ db=/data/data/com.android.providers.contacts/databases/contacts2.db # Otherwise sqlite3 would create an empty file owned by root. # Sed inserts a newline after each ( and , -adb shell "(ls $db >/dev/null)&& sqlite3 $db \"select name, sql from sqlite_master where type in('table','index') order by name\"" | +adb shell "(ls $db >/dev/null)&& sqlite3 $db \"select name, sql from sqlite_master where type in('table','index', 'view') order by name\"" | sed -e 's/\([(,]\)/\1\n /g' echo "> sqlite_stat1" adb shell "(ls $db >/dev/null)&& sqlite3 $db \"select * from sqlite_stat1 order by tbl, idx, stat\"" |