feat: Add color and icon properties to categories, enhance category management in UI
This commit is contained in:
@@ -15,6 +15,8 @@ class Categories extends Table {
|
||||
integer().named('server_version').withDefault(const Constant(0))();
|
||||
BoolColumn get isDeleted =>
|
||||
boolean().named('is_deleted').withDefault(const Constant(false))();
|
||||
IntColumn get colorValue => integer().nullable().named('color_value')();
|
||||
IntColumn get iconCodePoint => integer().nullable().named('icon_code_point')();
|
||||
BoolColumn get isDirty =>
|
||||
boolean().named('is_dirty').withDefault(const Constant(true))();
|
||||
DateTimeColumn get updatedAt => dateTime().named('updated_at')();
|
||||
@@ -46,7 +48,7 @@ class Notes extends Table {
|
||||
@DriftDatabase(tables: [Notes, Categories])
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
@override
|
||||
int get schemaVersion => 2;
|
||||
int get schemaVersion => 3;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
@@ -61,6 +63,12 @@ class AppDatabase extends _$AppDatabase {
|
||||
await customStatement('UPDATE notes SET is_dirty = 0');
|
||||
await customStatement('UPDATE categories SET is_dirty = 0');
|
||||
}
|
||||
if (from < 3) {
|
||||
await migrator.addColumn(categories, categories.colorValue);
|
||||
await migrator.addColumn(categories, categories.iconCodePoint);
|
||||
await customStatement('UPDATE categories SET color_value = NULL');
|
||||
await customStatement('UPDATE categories SET icon_code_point = NULL');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user