Add deleted column to store table

pull/467/head
Alex Baker 8 years ago
parent f81f52dccb
commit 62013dc0fb

@ -46,7 +46,7 @@ import timber.log.Timber;
@ApplicationScope
public class Database {
private static final int VERSION = 36;
private static final int VERSION = 37;
private static final String NAME = "database";
private static final Table[] TABLES = new Table[] {
Task.TABLE,
@ -118,12 +118,9 @@ public class Database {
SqlConstructorVisitor visitor = new SqlConstructorVisitor();
switch(oldVersion) {
case 35:
try {
tryExecSQL(addColumnSql(TagData.TABLE, TagData.COLOR, visitor, "-1"));
} catch (SQLiteException e) {
tracker.reportException(e);
}
tryExecSQL(addColumnSql(TagData.TABLE, TagData.COLOR, visitor, "-1"));
case 36:
tryExecSQL(addColumnSql(StoreObject.TABLE, StoreObject.DELETION_DATE, visitor, "0"));
return true;
}
@ -134,7 +131,7 @@ public class Database {
try {
database.execSQL(sql);
} catch (SQLiteException e) {
Timber.e(e, "SQL Error: %s", sql);
tracker.reportException(e);
}
}

@ -60,6 +60,10 @@ public class StoreObject extends AbstractModel {
public static final StringProperty VALUE3 = new StringProperty(
TABLE, "value3");
/** Unixtime Task was deleted. 0 means not deleted */
public static final LongProperty DELETION_DATE = new LongProperty(
TABLE, "deleted", Property.PROP_FLAG_DATE);
/** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(StoreObject.class);
@ -68,6 +72,10 @@ public class StoreObject extends AbstractModel {
/** Default values container */
private static final ContentValues defaultValues = new ContentValues();
static {
defaultValues.put(DELETION_DATE.name, 0);
}
@Override
public ContentValues getDefaultValues() {
return defaultValues;

Loading…
Cancel
Save