Move settings fields from camelCase to snake_case
This commit is contained in:
parent
6810b84310
commit
de926bce0e
|
@ -17,7 +17,7 @@ class MyDatabase extends _$MyDatabase {
|
||||||
MyDatabase() : super(_openConnection());
|
MyDatabase() : super(_openConnection());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 2;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
|
@ -27,7 +27,28 @@ class MyDatabase extends _$MyDatabase {
|
||||||
if (data.isEmpty) await db.into(db.settings).insert(defaultSettings);
|
if (data.isEmpty) await db.into(db.settings).insert(defaultSettings);
|
||||||
},
|
},
|
||||||
onUpgrade: (Migrator m, int from, int to) async {
|
onUpgrade: (Migrator m, int from, int to) async {
|
||||||
// no migrations yet
|
if (from == 1) {
|
||||||
|
await m.addColumn(settings, settings.darkColor);
|
||||||
|
await db.customStatement('''
|
||||||
|
UPDATE settings SET dark_color = darkColor
|
||||||
|
''');
|
||||||
|
await m.addColumn(settings, settings.lightColor);
|
||||||
|
await db.customStatement('''
|
||||||
|
UPDATE settings SET light_color = lightColor
|
||||||
|
''');
|
||||||
|
await m.addColumn(settings, settings.showDate);
|
||||||
|
await db.customStatement('''
|
||||||
|
UPDATE settings SET show_date = showDate
|
||||||
|
''');
|
||||||
|
await m.addColumn(settings, settings.showSets);
|
||||||
|
await db.customStatement('''
|
||||||
|
UPDATE settings SET show_sets = showSets
|
||||||
|
''');
|
||||||
|
await m.addColumn(settings, settings.showUnit);
|
||||||
|
await db.customStatement('''
|
||||||
|
UPDATE settings SET show_unit = showUnit
|
||||||
|
''');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user