add a new db column for Repeat Count

This commit is contained in:
tibbi 2017-04-17 17:25:36 +02:00
parent c79cce6f34
commit bf02bb5c18

View File

@ -38,6 +38,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
private val COL_REPEAT_INTERVAL = "repeat_interval" private val COL_REPEAT_INTERVAL = "repeat_interval"
private val COL_REPEAT_RULE = "repeat_rule" private val COL_REPEAT_RULE = "repeat_rule"
private val COL_REPEAT_LIMIT = "repeat_limit" private val COL_REPEAT_LIMIT = "repeat_limit"
private val COL_REPEAT_COUNT = "repeat_count"
private val TYPES_TABLE_NAME = "event_types" private val TYPES_TABLE_NAME = "event_types"
private val COL_TYPE_ID = "event_type_id" private val COL_TYPE_ID = "event_type_id"
@ -119,13 +120,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
if (oldVersion < 11) { if (oldVersion < 11) {
db.execSQL("ALTER TABLE $META_TABLE_NAME ADD COLUMN $COL_REPEAT_RULE INTEGER NOT NULL DEFAULT 0") db.execSQL("ALTER TABLE $META_TABLE_NAME ADD COLUMN $COL_REPEAT_RULE INTEGER NOT NULL DEFAULT 0")
db.execSQL("ALTER TABLE $META_TABLE_NAME ADD COLUMN $COL_REPEAT_COUNT INTEGER NOT NULL DEFAULT 0")
setupRepeatRules(db) setupRepeatRules(db)
} }
} }
private fun createMetaTable(db: SQLiteDatabase) { private fun createMetaTable(db: SQLiteDatabase) {
db.execSQL("CREATE TABLE $META_TABLE_NAME ($COL_ID INTEGER PRIMARY KEY, $COL_EVENT_ID INTEGER UNIQUE, $COL_REPEAT_START INTEGER, " + db.execSQL("CREATE TABLE $META_TABLE_NAME ($COL_ID INTEGER PRIMARY KEY, $COL_EVENT_ID INTEGER UNIQUE, $COL_REPEAT_START INTEGER, " +
"$COL_REPEAT_INTERVAL INTEGER, $COL_REPEAT_LIMIT INTEGER, $COL_REPEAT_RULE INTEGER)") "$COL_REPEAT_INTERVAL INTEGER, $COL_REPEAT_LIMIT INTEGER, $COL_REPEAT_RULE INTEGER, $COL_REPEAT_COUNT INTEGER)")
} }
private fun createTypesTable(db: SQLiteDatabase) { private fun createTypesTable(db: SQLiteDatabase) {