perf(settings): batch and deduplicate writes and persist panel dimensions

This commit is contained in:
lingjhf committed 2026-10-09 19:20:54 +08:00
1 parent bc3fdd6119
commit 02413383d8
23 files changed
+869 -83

No files matched your search

+11 -4
View File
@@ -127,6 +127,7 @@ class ProjectViewConfigurations extends Table {
TextColumn get projectId => text()();
BoolColumn get propertiesOpen => boolean()();
RealColumn get timelineHeight => real().nullable()();
RealColumn get mediaWidth => real().nullable()();
@override
Set<Column<Object>> get primaryKey => {projectId};
@@ -169,13 +170,13 @@ class AppDatabase extends _$AppDatabase {
AppDatabase(super.executor);
@override
int get schemaVersion => 4;
int get schemaVersion => 5;
@override
MigrationStrategy get migration => MigrationStrategy(
onCreate: (migrator) => migrator.createAll(),
onUpgrade: (migrator, from, _) async {
if (from != 2 && from != 3) {
if (from < 2 || from > 4) {
throw StateError('Unsupported app database schema version: $from');
}
if (from == 2) {
@@ -184,9 +185,15 @@ class AppDatabase extends _$AppDatabase {
appearanceConfigurations.palette,
);
}
if (from < 4) {
await migrator.addColumn(
appearanceConfigurations,
appearanceConfigurations.timelineRulerLayout,
);
}
await migrator.addColumn(
appearanceConfigurations,
appearanceConfigurations.timelineRulerLayout,
projectViewConfigurations,
projectViewConfigurations.mediaWidth,
);
},
beforeOpen: (_) async {