Happy New Year for you.
How i can create Room migration by internal project file?
Ex: I have file with sql script in path: /assets/migrations/10.sql
I have this method:
private static final Migration MIGRATION_9_10 = new Migration(9, 10) {
@Override
public void migrate(SupportSQLiteDatabase database) {
String scriptId = "10_"+DATABASE_LANGUAGE+".sql";
Log.d("TEST", "MIGRATE TO 10: " + database.getVersion()+"NME: "+scriptId);
InputStream inputStream = null;
try {
inputStream = DATABASE_CONTEXT.getAssets().open(scriptId);
Log.d("TEST", "InputStream: " + inputStream.toString());
database.execSQL(readString(inputStream));
//db.execSQL(initSql);
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream);
}
}
};
but always this table empty in logs. How i can do it correct? Thank you!