Remove db restriction for category column.

SettingsIntelligence should be able to extend support to more categories
without changing Settings.

Bug: 118708391
Test: rebuild
Change-Id: I420394f718bb3712e94040fb3e3c4f66cca629af
This commit is contained in:
Fan Zhang
2018-11-01 16:28:15 -07:00
parent 0af2ade371
commit 7775f67053

View File

@@ -30,7 +30,7 @@ import androidx.annotation.VisibleForTesting;
public class CardDatabaseHelper extends SQLiteOpenHelper { public class CardDatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = "CardDatabaseHelper"; private static final String TAG = "CardDatabaseHelper";
private static final String DATABASE_NAME = "homepage_cards.db"; private static final String DATABASE_NAME = "homepage_cards.db";
private static final int DATABASE_VERSION = 3; private static final int DATABASE_VERSION = 4;
public static final String CARD_TABLE = "cards"; public static final String CARD_TABLE = "cards";
@@ -56,7 +56,7 @@ public class CardDatabaseHelper extends SQLiteOpenHelper {
String SLICE_URI = "slice_uri"; String SLICE_URI = "slice_uri";
/** /**
* Category of the card. The value is between 0 to 3. * Category of the card.
*/ */
String CATEGORY = "category"; String CATEGORY = "category";
@@ -133,11 +133,7 @@ public class CardDatabaseHelper extends SQLiteOpenHelper {
CardColumns.SLICE_URI + CardColumns.SLICE_URI +
" TEXT, " + " TEXT, " +
CardColumns.CATEGORY + CardColumns.CATEGORY +
" INTEGER DEFAULT 0 CHECK (" + " INTEGER DEFAULT 0, " +
CardColumns.CATEGORY +
" >= 0 AND " +
CardColumns.CATEGORY +
" <= 3), " +
CardColumns.LOCALIZED_TO_LOCALE + CardColumns.LOCALIZED_TO_LOCALE +
" TEXT, " + " TEXT, " +
CardColumns.PACKAGE_NAME + CardColumns.PACKAGE_NAME +