How to migrate exsiting sqlite table to ROOM Db which have data types like VCHAR, TIMESTAMP?
Yes, There is a problem in TIMESTAMP and VARCHARyou should change it to:
static final Migration MIGRATION_1_2 = new Migration(1, 2) { @Override public void migrate(SupportSQLiteDatabase database) { // Create the new table database.execSQL( "CREATE TABLE users_new (id INTEGER PRIMARY KEY AUTOINCREMENT,api_response_json TEXT, api_req TEXT,post_params TEXT,req_type TEXT,timestamp TEXT)"); // Copy the data database.execSQL("INSERT INTO users_new (id,api_response_json, api_req,post_params,req_type,timestamp) " + "SELECT id,api_response_json, api_req,post_params, req_type,timestamp " + "FROM old_Table_name"); // Remove the old table database.execSQL("DROP TABLE old_Table_name"); // Change the table name to the correct one database.execSQL("ALTER TABLE users_new RENAME TO old_Table_name");} };
the answer was inside your migration error