Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error migrating from v3 to v4 database. #1154

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

MR-TZ-dev
Copy link
Contributor

Patch to migration error from database v3 to v4.

flutter: 09:42:31.414513 [INFO]     [bootstrap] initializing [directories]
flutter: 09:42:31.415922 [DEBUG]    [bootstrap] [directories] initialized in 1ms
flutter: 09:42:31.416026 [INFO]     [bootstrap] initializing [app info]
flutter: 09:42:31.417047 [DEBUG]    [bootstrap] [app info] initialized in 1ms
flutter: 09:42:31.417103 [INFO]     [bootstrap] initializing [preferences]
flutter: 09:42:31.417171 [DEBUG]    [preferences] initializing preferences
flutter: 09:42:31.417750 [DEBUG]    [bootstrap] [preferences] initialized in 0ms
flutter: 09:42:31.417822 [INFO]     [bootstrap] initializing [preferences migration]
flutter: 09:42:31.417846 [DEBUG]    [PreferencesMigration] already using the latest version (v1)
flutter: 09:42:31.417863 [DEBUG]    [bootstrap] [preferences migration] initialized in 0ms
flutter: 09:42:31.417911 [DEBUG]    [PreferencesEntry<bool, dynamic>] getting persisted preference [debug_mode](bool)
flutter: 09:42:31.417926 [INFO]     [bootstrap] initializing [window controller]
flutter: 09:42:31.421823 [DEBUG]    [bootstrap] [window controller] initialized in 3ms
flutter: 09:42:31.422185 [DEBUG]    [PreferencesEntry<bool, bool>] getting persisted preference [silent_start](bool)
flutter: 09:42:31.422314 [DEBUG]    [bootstrap] silent start [Disabled]
flutter: 09:42:31.424946 [INFO]     [bootstrap] initializing [auto start service]
flutter: 09:42:31.425125 [INFO]     [AutoStartNotifier] auto start is [Disabled]
flutter: 09:42:31.425144 [DEBUG]    [bootstrap] [auto start service] initialized in 0ms
flutter: 09:42:31.425156 [INFO]     [bootstrap] initializing [logs repository]
flutter: 09:42:31.426733 [DEBUG]    [bootstrap] [logs repository] initialized in 1ms
flutter: 09:42:31.426801 [INFO]     [bootstrap] initializing [logger controller]
flutter: 09:42:31.426845 [INFO]     [bootstrap] hiddify v2.0.5 (20005) [prod]
general release
linux [Linux 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 21:49:14 UTC 2024]
flutter: 09:42:31.426864 [INFO]     [bootstrap] initializing [profile repository]
flutter: 09:42:31.427318 [INFO]     [bootstrap] initializing [active profile]
flutter: 09:42:31.428903 [ERROR]    [ProfileRepositoryImpl] error watching active profile
flutter: #0      throwException (package:sqlite3/src/implementation/exception.dart:75)
#1      DatabaseImplementation.execute (package:sqlite3/src/implementation/database.dart:244)
#2      Sqlite3Delegate.runWithArgsSync (package:drift/src/sqlite3/database.dart:145)
#3      _NativeDelegate.runCustom.<anonymous closure> (package:drift/native.dart:326)
#4      new Future.sync (dart:async/future.dart:306)
#5      _NativeDelegate.runCustom (package:drift/native.dart:326)
#6      _BaseExecutor.runCustom.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:115)
#7      _BaseExecutor._synchronized (package:drift/src/runtime/executor/helpers/engines.dart:61)
#8      _BaseExecutor.runCustom (package:drift/src/runtime/executor/helpers/engines.dart:111)
#9      DatabaseConnectionUser.customStatement.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:389)
#10     DatabaseConnectionUser.doWhenOpened.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:162)
#11     _rootRunUnary (dart:async/zone.dart:1407)
<asynchronous suspension>
#12     AppDatabase.migration.<anonymous closure> (package:hiddify/core/database/app_database.dart:52)
<asynchronous suspension>
#13     migrationSteps.<anonymous closure> (package:hiddify/core/database/schema_versions.dart:169)
<asynchronous suspension>
#14     VersionedSchema.runMigrationSteps (package:drift/internal/versioned_schema.dart:103)
<asynchronous suspension>
#15     VersionedSchema.stepByStepHelper.<anonymous closure> (package:drift/internal/versioned_schema.dart:54)
<asynchronous suspension>
#16     GeneratedDatabase.beforeOpen.<anonymous closure> (package:drift/src/runtime/api/db_base.dart:133)
<asynchronous suspension>
#17     DelegatedDatabase._runMigrations (package:drift/src/runtime/executor/helpers/engines.dart:471)
<asynchronous suspension>
#18     DelegatedDatabase.ensureOpen.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:435)
<asynchronous suspension>
#19     _AsyncCompleter.complete (dart:async/future_impl.dart:41)
<asynchronous suspension>

flutter: 09:42:31.429143 [ERROR]    [ProfileRepositoryImpl] error watching active profile
flutter: #0      throwException (package:sqlite3/src/implementation/exception.dart:75)
#1      DatabaseImplementation.execute (package:sqlite3/src/implementation/database.dart:244)
#2      Sqlite3Delegate.runWithArgsSync (package:drift/src/sqlite3/database.dart:145)
#3      _NativeDelegate.runCustom.<anonymous closure> (package:drift/native.dart:326)
#4      new Future.sync (dart:async/future.dart:306)
#5      _NativeDelegate.runCustom (package:drift/native.dart:326)
#6      _BaseExecutor.runCustom.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:115)
#7      _BaseExecutor._synchronized (package:drift/src/runtime/executor/helpers/engines.dart:61)
#8      _BaseExecutor.runCustom (package:drift/src/runtime/executor/helpers/engines.dart:111)
#9      DatabaseConnectionUser.customStatement.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:389)
#10     DatabaseConnectionUser.doWhenOpened.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:162)
#11     _rootRunUnary (dart:async/zone.dart:1407)
<asynchronous suspension>
#12     AppDatabase.migration.<anonymous closure> (package:hiddify/core/database/app_database.dart:52)
<asynchronous suspension>
#13     migrationSteps.<anonymous closure> (package:hiddify/core/database/schema_versions.dart:169)
<asynchronous suspension>
#14     VersionedSchema.runMigrationSteps (package:drift/internal/versioned_schema.dart:103)
<asynchronous suspension>
#15     VersionedSchema.stepByStepHelper.<anonymous closure> (package:drift/internal/versioned_schema.dart:54)
<asynchronous suspension>
#16     GeneratedDatabase.beforeOpen.<anonymous closure> (package:drift/src/runtime/api/db_base.dart:133)
<asynchronous suspension>
#17     DelegatedDatabase._runMigrations (package:drift/src/runtime/executor/helpers/engines.dart:471)
<asynchronous suspension>
#18     DelegatedDatabase.ensureOpen.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:435)
<asynchronous suspension>
#19     _AsyncCompleter.complete (dart:async/future_impl.dart:41)
<asynchronous suspension>

flutter: 09:42:31.429455 [ERROR]    [bootstrap] [active profile] error initializing
flutter: #0      ActiveProfile.build.<anonymous closure>.<anonymous closure> (package:hiddify/features/profile/notifier/active_profile_notifier.dart:17)
#1      Left.getOrElse (package:fpdart/src/either.dart:646)
#2      ActiveProfile.build.<anonymous closure> (package:hiddify/features/profile/notifier/active_profile_notifier.dart:17)
#3      _MapStream._handleData (dart:async/stream_pipe.dart:213)
#4      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
#5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:297)
#8      _MultiStreamController.addSync (dart:async/stream_impl.dart:1127)
#9      _MultiControllerSink.add (package:rxdart/src/utils/forwarding_stream.dart:130)
#10     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#12     _DelayedData.perform (dart:async/stream_impl.dart:541)
#13     _PendingEvents.handleNext (dart:async/stream_impl.dart:646)
#14     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617)
#15     _microtaskLoop (dart:async/schedule_microtask.dart:40)
#16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

flutter: 09:42:31.429738 [INFO]     [bootstrap] initializing [deep link service]
flutter: 09:42:31.430033 [INFO]     [bootstrap] initializing [sing-box]
flutter: 09:42:31.430132 [INFO]     [bootstrap] initializing [system tray]
flutter: 09:42:31.432605 [INFO]     [ConnectionNotifier] connection status: DISCONNECTED
flutter: 09:42:31.436405 [INFO]     [bootstrap] bootstrap took [21ms]
flutter: 09:42:31.444498 [ERROR]    [ForegroundProfilesUpdateNotifier] error getting profiles
flutter: Exception: ProfileFailure.unexpected(error: SqliteException(1): while executing, duplicate column name: test_url, SQL logic error (code 1)
flutter:   Causing statement: ALTER TABLE "profile_entries" ADD COLUMN "test_url" TEXT NULL;, parameters: , stackTrace: #0      throwException (package:sqlite3/src/implementation/exception.dart:75)
flutter: #1      DatabaseImplementation.execute (package:sqlite3/src/implementation/database.dart:244)
flutter: #2      Sqlite3Delegate.runWithArgsSync (package:drift/src/sqlite3/database.dart:145)
flutter: #3      _NativeDelegate.runCustom.<anonymous closure> (package:drift/native.dart:326)
flutter: #4      new Future.sync (dart:async/future.dart:306)
flutter: #5      _NativeDelegate.runCustom (package:drift/native.dart:326)
flutter: #6      _BaseExecutor.runCustom.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:115)
flutter: #7      _BaseExecutor._synchronized (package:drift/src/runtime/executor/helpers/engines.dart:61)
flutter: #8      _BaseExecutor.runCustom (package:drift/src/runtime/executor/helpers/engines.dart:111)
flutter: #9      DatabaseConnectionUser.customStatement.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:389)
flutter: #10     DatabaseConnectionUser.doWhenOpened.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:162)
flutter: #11     _rootRunUnary (dart:async/zone.dart:1407)
flutter: <asynchronous suspension>
flutter: #12     AppDatabase.migration.<anonymous closure> (package:hiddify/core/database/app_database.dart:52)
flutter: <asynchronous suspension>
flutter: #13     migrationSteps.<anonymous closure> (package:hiddify/core/database/schema_versions.dart:169)
flutter: <asynchronous suspension>
flutter: #14     VersionedSchema.runMigrationSteps (package:drift/internal/versioned_schema.dart:103)
flutter: <asynchronous suspension>
flutter: #15     VersionedSchema.stepByStepHelper.<anonymous closure> (package:drift/internal/versioned_schema.dart:54)
flutter: <asynchronous suspension>
flutter: #16     GeneratedDatabase.beforeOpen.<anonymous closure> (package:drift/src/runtime/api/db_base.dart:133)
flutter: <asynchronous suspension>
flutter: #17     DelegatedDatabase._runMigrations (package:drift/src/runtime/executor/helpers/engines.dart:471)
flutter: <asynchronous suspension>
flutter: #18     DelegatedDatabase.ensureOpen.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:435)
flutter: <asynchronous suspension>
flutter: #19     _AsyncCompleter.complete (dart:async/future_impl.dart:41)
flutter: <asynchronous suspension>
flutter: )
flutter: #0      ForegroundProfilesUpdateNotifier.updateProfiles.<anonymous closure>.<anonymous closure> (package:hiddify/features/profile/notifier/profiles_update_notifier.dart:88)
flutter: #1      Left.getOrElse (package:fpdart/src/either.dart:646)
flutter: #2      ForegroundProfilesUpdateNotifier.updateProfiles.<anonymous closure> (package:hiddify/features/profile/notifier/profiles_update_notifier.dart:86)
flutter: #9      _MultiControllerSink.add (package:rxdart/src/utils/forwarding_stream.dart:130)
flutter: (elided 13 frames from dart:async)
flutter: dynamic_color: Accent color detected.
flutter: 10:02:31.465751 [ERROR]    [ForegroundProfilesUpdateNotifier] error getting profiles
flutter: Another exception was thrown: Instance of 'DiagnosticsProperty<void>'
flutter: 10:17:40.952459 [ERROR]    [app] PlatformDispatcherError: ProfileFailure.unexpected(error: SqliteException(1): while executing, duplicate column name: test_url, SQL logic error (code 1)
  Causing statement: ALTER TABLE "profile_entries" ADD COLUMN "test_url" TEXT NULL;, parameters: , stackTrace: #0      throwException (package:sqlite3/src/implementation/exception.dart:75)
#1      DatabaseImplementation.execute (package:sqlite3/src/implementation/database.dart:244)
#2      Sqlite3Delegate.runWithArgsSync (package:drift/src/sqlite3/database.dart:145)
#3      _NativeDelegate.runCustom.<anonymous closure> (package:drift/native.dart:326)
#4      new Future.sync (dart:async/future.dart:306)
#5      _NativeDelegate.runCustom (package:drift/native.dart:326)
#6      _BaseExecutor.runCustom.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:115)
#7      _BaseExecutor._synchronized (package:drift/src/runtime/executor/helpers/engines.dart:61)
#8      _BaseExecutor.runCustom (package:drift/src/runtime/executor/helpers/engines.dart:111)
#9      DatabaseConnectionUser.customStatement.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:389)
#10     DatabaseConnectionUser.doWhenOpened.<anonymous closure> (package:drift/src/runtime/api/connection_user.dart:162)
#11     _rootRunUnary (dart:async/zone.dart:1407)
<asynchronous suspension>
#12     AppDatabase.migration.<anonymous closure> (package:hiddify/core/database/app_database.dart:52)
<asynchronous suspension>
#13     migrationSteps.<anonymous closure> (package:hiddify/core/database/schema_versions.dart:169)
<asynchronous suspension>
#14     VersionedSchema.runMigrationSteps (package:drift/internal/versioned_schema.dart:103)
<asynchronous suspension>
#15     VersionedSchema.stepByStepHelper.<anonymous closure> (package:drift/internal/versioned_schema.dart:54)
<asynchronous suspension>
#16     GeneratedDatabase.beforeOpen.<anonymous closure> (package:drift/src/runtime/api/db_base.dart:133)
<asynchronous suspension>
#17     DelegatedDatabase._runMigrations (package:drift/src/runtime/executor/helpers/engines.dart:471)
<asynchronous suspension>
#18     DelegatedDatabase.ensureOpen.<anonymous closure> (package:drift/src/runtime/executor/helpers/engines.dart:435)
<asynchronous suspension>
#19     _AsyncCompleter.complete (dart:async/future_impl.dart:41)
<asynchronous suspension>
)
flutter: #0      ActiveProfile.build.<anonymous closure>.<anonymous closure> (package:hiddify/features/profile/notifier/active_profile_notifier.dart:17)
#1      Left.getOrElse (package:fpdart/src/either.dart:646)
#2      ActiveProfile.build.<anonymous closure> (package:hiddify/features/profile/notifier/active_profile_notifier.dart:17)
#3      _MapStream._handleData (dart:async/stream_pipe.dart:213)
#4      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
#5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:297)
#8      _MultiStreamController.addSync (dart:async/stream_impl.dart:1127)
#9      _MultiControllerSink.add (package:rxdart/src/utils/forwarding_stream.dart:130)
#10     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#12     _DelayedData.perform (dart:async/stream_impl.dart:541)
#13     _PendingEvents.handleNext (dart:async/stream_impl.dart:646)
#14     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617)
#15     _microtaskLoop (dart:async/schedule_microtask.dart:40)
#16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

@hiddify-com hiddify-com merged commit ef1ee39 into hiddify:main Aug 2, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants