Reverting change to .classpath, bumping version number and deleting the drop

database call on unsupported migration. Instead we show a user popup
  indicating the database might be corrupted (which is really the most often
  case an end-user sees this message). Hopefully this is another step in
  preventing permanent data loss? Although if the database is corrupted it's
  unclear what we should do.
pull/14/head
Tim Su 16 years ago
parent 74ab94f6fb
commit a29e5de53f

@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="javax/xml/validation/|javax/xml/transform/dom/|javax/xml/parsers/|org/jaxp/transform/dom/|org/jaxp/transform/sax/|org/jaxp/transform/stax/|org/jaxp/transform/stream/|org/jaxp/stream/events/|org/jaxp/stream/util/|org/jaxp/parsers/|org/jaxp/stream/|org/jaxp/validation/" kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="lib" path="lib/locale_platform.jar"/>
<classpathentry kind="lib" path="lib/FlurryAgent.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Android 1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Python 2.6.4 interpreter library"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Android 1.6"/>
<classpathentry kind="output" path="out/production/astrid-2.x"/>
<classpathentry kind="output" path="ecbuild"/>
</classpath>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid"
android:versionCode="126" android:versionName="2.11.2">
android:versionCode="120" android:versionName="2.12.0">
<!-- ============================ Metadata ============================ -->

@ -31,6 +31,7 @@ import android.util.Log;
import com.timsu.astrid.data.AbstractController;
import com.timsu.astrid.data.AbstractModel;
import com.timsu.astrid.data.task.TaskIdentifier;
import com.timsu.astrid.utilities.DialogUtilities;
/** A single alert on a task */
@ -63,10 +64,12 @@ public class Alert extends AbstractModel {
/** Database Helper manages creating new tables and updating old ones */
static class AlertDatabaseHelper extends SQLiteOpenHelper {
String tableName;
Context context;
AlertDatabaseHelper(Context context, String databaseName, String tableName) {
super(context, databaseName, null, VERSION);
this.tableName = tableName;
this.context = context;
}
@Override
@ -88,10 +91,9 @@ public class Alert extends AbstractModel {
switch(oldVersion) {
default:
// we don't know how to handle it... do the unfortunate thing
Log.e(getClass().getSimpleName(), "Unsupported migration, table dropped!");
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
// we don't know how to handle it... show an error
Log.e(getClass().getSimpleName(), "Unsupported migration from " + oldVersion + " to " + newVersion);
DialogUtilities.okDialog(context, "There was a database error reading from Alerts. Data may have been corrupted.", null);
}
}
}

@ -30,6 +30,7 @@ import com.timsu.astrid.data.AbstractController;
import com.timsu.astrid.data.AbstractModel;
import com.timsu.astrid.data.task.TaskIdentifier;
import com.timsu.astrid.sync.TaskProxy;
import com.timsu.astrid.utilities.DialogUtilities;
/** A single tag on a task */
@ -70,10 +71,12 @@ public class SyncMapping extends AbstractModel {
/** Database Helper manages creating new tables and updating old ones */
static class SyncMappingDatabaseHelper extends SQLiteOpenHelper {
String tableName;
Context context;
SyncMappingDatabaseHelper(Context context, String databaseName, String tableName) {
super(context, databaseName, null, VERSION);
this.tableName = tableName;
this.context = context;
}
@Override
@ -97,10 +100,9 @@ public class SyncMapping extends AbstractModel {
switch(oldVersion) {
default:
// we don't know how to handle it... do the unfortunate thing
Log.e(getClass().getSimpleName(), "Unsupported migration, table dropped!");
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
// we don't know how to handle it... show an error
Log.e(getClass().getSimpleName(), "Unsupported migration from " + oldVersion + " to " + newVersion);
DialogUtilities.okDialog(context, "There was a database error reading from Alerts. Data may have been corrupted.", null);
}
}
}

@ -30,6 +30,7 @@ import android.util.Log;
import com.timsu.astrid.data.AbstractController;
import com.timsu.astrid.data.AbstractModel;
import com.timsu.astrid.utilities.DialogUtilities;
/** Abstract model of a task. Subclasses implement the getters and setters
@ -81,10 +82,12 @@ public abstract class AbstractTagModel extends AbstractModel {
/** Database Helper manages creating new tables and updating old ones */
static class TagModelDatabaseHelper extends SQLiteOpenHelper {
String tableName;
Context context;
TagModelDatabaseHelper(Context context, String databaseName, String tableName) {
super(context, databaseName, null, VERSION);
this.tableName = tableName;
this.context = context;
}
@Override
@ -112,10 +115,9 @@ public abstract class AbstractTagModel extends AbstractModel {
switch(oldVersion) {
default:
// we don't know how to handle it... do the unfortunate thing
Log.e(getClass().getSimpleName(), "Unsupported migration, table dropped!");
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
// we don't know how to handle it... show an error
Log.e(getClass().getSimpleName(), "Unsupported migration from " + oldVersion + " to " + newVersion);
DialogUtilities.okDialog(context, "There was a database error reading from Alerts. Data may have been corrupted.", null);
}
}
}

@ -29,6 +29,7 @@ import android.util.Log;
import com.timsu.astrid.data.AbstractController;
import com.timsu.astrid.data.AbstractModel;
import com.timsu.astrid.data.task.TaskIdentifier;
import com.timsu.astrid.utilities.DialogUtilities;
/** A single tag on a task */
@ -61,10 +62,12 @@ public class TagToTaskMapping extends AbstractModel {
/** Database Helper manages creating new tables and updating old ones */
static class TagToTaskMappingDatabaseHelper extends SQLiteOpenHelper {
String tableName;
Context context;
TagToTaskMappingDatabaseHelper(Context context, String databaseName, String tableName) {
super(context, databaseName, null, VERSION);
this.tableName = tableName;
this.context = context;
}
@Override
@ -86,10 +89,9 @@ public class TagToTaskMapping extends AbstractModel {
switch(oldVersion) {
default:
// we don't know how to handle it... do the unfortunate thing
Log.e(getClass().getSimpleName(), "Unsupported migration, table dropped!");
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
// we don't know how to handle it... show an error
Log.e(getClass().getSimpleName(), "Unsupported migration from " + oldVersion + " to " + newVersion);
DialogUtilities.okDialog(context, "There was a database error reading from Alerts. Data may have been corrupted.", null);
}
}
}

@ -33,6 +33,7 @@ import com.timsu.astrid.data.AbstractController;
import com.timsu.astrid.data.AbstractModel;
import com.timsu.astrid.data.enums.Importance;
import com.timsu.astrid.data.enums.RepeatInterval;
import com.timsu.astrid.utilities.DialogUtilities;
import com.timsu.astrid.utilities.Preferences;
@ -116,10 +117,12 @@ public abstract class AbstractTaskModel extends AbstractModel {
/** Database Helper manages creating new tables and updating old ones */
public static class TaskModelDatabaseHelper extends SQLiteOpenHelper {
String tableName;
Context context;
public TaskModelDatabaseHelper(Context context, String databaseName, String tableName) {
super(context, databaseName, null, VERSION);
this.tableName = tableName;
this.context = context;
}
@Override
@ -253,10 +256,9 @@ public abstract class AbstractTaskModel extends AbstractModel {
break;
default:
// we don't know how to handle it... do the unfortunate thing
Log.e(getClass().getSimpleName(), "Unsupported migration, table dropped!");
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
// we don't know how to handle it... show an error
Log.e(getClass().getSimpleName(), "Unsupported migration from " + oldVersion + " to " + newVersion);
DialogUtilities.okDialog(context, "There was a database error reading from Alerts. Data may have been corrupted.", null);
}
}
}

Loading…
Cancel
Save