Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/core/storage/migrations/migrations.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export 'package:bb_mobile/core/storage/migrations/schema_0_to_1.dart';
export 'package:bb_mobile/core/storage/migrations/schema_10_to_11.dart';
export 'package:bb_mobile/core/storage/migrations/schema_11_to_12.dart';
export 'package:bb_mobile/core/storage/migrations/schema_12_to_13.dart';
export 'package:bb_mobile/core/storage/migrations/schema_1_to_2.dart';
export 'package:bb_mobile/core/storage/migrations/schema_2_to_3.dart';
export 'package:bb_mobile/core/storage/migrations/schema_3_to_4.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/core/storage/migrations/schema_0_to_1.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:bb_mobile/core/storage/database_seeds.dart';
import 'package:bb_mobile/core/storage/sqlite_database.dart';
import 'package:bb_mobile/features/settings/frameworks/drift/migrations/on_create_migration.dart';
import 'package:drift/drift.dart';

class Schema0To1 {
Expand All @@ -22,6 +23,7 @@ class Schema0To1 {
//
// Make sure to only seed NEW columns/rows and don't overwrite existing data.
await Future.wait([
AppSettingsOnCreateMigration.seed(m.database as SqliteDatabase),
DatabaseSeeds.seedDefaultSettings(m.database as SqliteDatabase),
DatabaseSeeds.seedDefaultElectrumServers(m.database as SqliteDatabase),
DatabaseSeeds.seedDefaultElectrumSettings(m.database as SqliteDatabase),
Expand Down
26 changes: 26 additions & 0 deletions lib/core/storage/migrations/schema_12_to_13.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:bb_mobile/core/storage/sqlite_database.steps.dart';
import 'package:bb_mobile/features/settings/frameworks/drift/migrations/settings_to_app_settings_migration.dart';
import 'package:drift/drift.dart';

/// Migration from version 12 to 13
///
/// Changes:
/// - Creates new app_settings table for general app-wide settings
/// - Migrates data from settings table to app_settings table
/// - Old settings table remains for feature-specific settings (Tor, error reporting)
///
/// Field mappings:
/// - environment → environmentMode
/// - currency → fiatCurrency
/// - bitcoinUnit → bitcoinUnit
/// - language → language
/// - hideAmounts → hideAmounts
/// - isSuperuser → superuserModeEnabled
/// - isDevModeEnabled → featureLevel (alpha if enabled, stable if disabled)
/// - themeMode → themeMode
class Schema12To13 {
static Future<void> migrate(Migrator m, Schema13 schema13) async {
// Create and populate the new app_settings table
await SettingsToAppSettingsMigration.migrate(m, schema13);
}
}
Loading
Loading