You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm facing a problem on Windows, when a new version of my application is launched with migrations to be executed, some clients run the migrations, that is, they update the tables, but the PRAGMA version does not update, and when opening the app again the system tries to run the migrations again, this causes some duplicate column errors or something like that. I would like to know if anyone else has experienced something similar and what the possible solution is.
My code:
FutureOr<void> _onUpgrade(Database db, int oldVersion, int newVersion) async {
await db.transaction((txn) async {
awaitSQFliteUtils.removeAllTriggers(txn);
Batch batch = txn.batch();
if (newVersion != oldVersion) {
batch.delete('ncm_config');
}
if (oldVersion <1) {
batch.execute(''' CREATE TABLE test1 ( id_teste1 TEXT PRIMARY KEY NOT NULL, nome TEXT NOT NULL ); ''');
batch.execute(''' CREATE TABLE test2 ( id_teste2 TEXT PRIMARY KEY NOT NULL, nome TEXT NOT NULL ); ''');
}
if (oldVersion <2) {
//Migrations version 2
}
enableTriggers(batch);
await batch.commit(noResult:true);
});
}
Hello, I'm facing a problem on Windows, when a new version of my application is launched with migrations to be executed, some clients run the migrations, that is, they update the tables, but the PRAGMA version does not update, and when opening the app again the system tries to run the migrations again, this causes some duplicate column errors or something like that. I would like to know if anyone else has experienced something similar and what the possible solution is.
My code:
The text was updated successfully, but these errors were encountered: