Skip to content

Commit 1016467

Browse files
committed
Fix migration running wrong way
1 parent b51e720 commit 1016467

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/main.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,22 @@ Future<void> migrateNovelData() async {
8181
'novel_data_migration_complete_v2',
8282
defaultValue: false,
8383
);
84+
final fixApplied = prefs.getBool(
85+
'novel_data_migration_fix_applied',
86+
defaultValue: false,
87+
);
8488
final hasBackup = prefs.getString('bookmarked_novels_backup').isNotEmpty;
8589

86-
// If migration was done but we still have backup, fix the migration
87-
if (migrationComplete && hasBackup) {
90+
// If migration was done but fix not applied yet, and we still have backup
91+
if (migrationComplete && !fixApplied && hasBackup) {
8892
debugPrint('🔧 Detected previous migration with URL issues, fixing...');
8993

9094
final fixSuccess = await migrationService.fixMigration();
9195

9296
if (fixSuccess) {
97+
// Mark fix as applied so it doesn't run again
98+
await prefs.setBool('novel_data_migration_fix_applied', true);
99+
93100
debugPrint('✅ Migration fix successful!');
94101

95102
// Show stats

0 commit comments

Comments
 (0)