I am using Active Android
in order to perform sqllite operations in my android app. Following is a model class.
@Table(name="books")
public class Books extends Model {
@Column(name = "bookId")
public String bookId;
@Column(name = "bookName")
public String bookName;
}
I want to add a new column to this. So I followed the instructions on Active Android's Schema Migration Doc.
a. Updated the AA_DB_VERSION
b. Added a new sql file in assets/migrations
Then when I run my app I get the below exception
1553-1553/com.hannan.delivery E/SQLiteLog﹕ (21) API called with NULL prepared statement
1553-1553/com.hannan.delivery E/SQLiteLog﹕ (21) misuse at line 63241 of [00bb9c9ce4]
java.lang.RuntimeException: Unable to create application com.hannan.delivery.MyApplication: android.database.sqlite.SQLiteException: not an error (code 0)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4154)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
....
Caused by: android.database.sqlite.SQLiteException: not an error (code 0)
at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:727)
at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1665)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
at com.activeandroid.DatabaseHelper.executeSqlScript(DatabaseHelper.java:180)
at com.activeandroid.DatabaseHelper.executeMigrations(DatabaseHelper.java:150)
at com.activeandroid.DatabaseHelper.onUpgrade(DatabaseHelper.java:74)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.activeandroid.Cache.openDatabase(Cache.java:102)
at com.activeandroid.Cache.initialize(Cache.java:75)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at com.hannan.delivery.MyApplication.onCreate(MyApplication.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
...
Here's MyApplication's Create method where it is failing.
@Override
public void onCreate() {
super.onCreate();
ActiveAndroid.initialize(this);
}
Migration Script is: (2.sql)
ALTER TABLE books ADD COLUMN bookAuthor TEXT;
Kindly suggest as to why I am getting this error.