Moor: Android Room-like destructive migration feature.

Created on 16 May 2020  路  2Comments  路  Source: simolus3/moor

database = Room.databaseBuilder(context.getApplicationContext(),
UsersDatabase.class, "Sample.db")
.fallbackToDestructiveMigration()
.build();

This will be useful when we use db for caching. Just need to bump up the schemaVersion and thats it. No need to write migrations.

enhancement

Most helpful comment

I like this idea, it will be added in the next moor version.

You'll be able to use it like this:

@UseMoor(...)
class MyDatabase extends _$MyDatabase {
  @override
  MigrationStrategy get migration => destructiveFallback;
}

All 2 comments

I like this idea, it will be added in the next moor version.

You'll be able to use it like this:

@UseMoor(...)
class MyDatabase extends _$MyDatabase {
  @override
  MigrationStrategy get migration => destructiveFallback;
}

This doesn't necessarily work when you remove a trigger or a table (entity), because it is not listed in allSchemaEntities anymore. The existing entities before the update need to be determined from the sqlite_master itself or the previous schema version once something like https://github.com/simolus3/moor/issues/240 exists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apoleo88 picture apoleo88  路  3Comments

jerryzhoujw picture jerryzhoujw  路  4Comments

felixjunghans picture felixjunghans  路  4Comments

johrpan picture johrpan  路  4Comments

KKRoko picture KKRoko  路  3Comments