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

Schema mismatch when using a restored download_tasks.db file between iOS and Android (no such column: _id) #981

Open
alexaungmyooo opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@alexaungmyooo
Copy link

Describe the bug

When restoring the download_tasks.db file from iOS to Android using the FlutterDownloader plugin, we encounter a schema mismatch error. The plugin fails to recognize the task table due to differences in the column names for the primary key. On iOS, the primary key is named id, whereas on Android, the plugin expects _id.

Error message:

E/SQLiteLog( 2769): (1) no such column: _id in "SELECT _id, task_id, progress, status, url, file_name, saved_dir, headers, mime_type, resumable, open_file_from_notification, show_notification, time_created, save_in_public_storage, allow_cellular FROM task"
E/SQLiteQuery( 2769): exception: no such column: _id (code 1 SQLITE_ERROR[1]); query: SELECT _id, task_id, progress, status, url, file_name, saved_dir, headers, mime_type, resumable, open_file_from_notification, show_notification, time_created, save_in_public_storage, allow_cellular FROM task

This happens because the schema for the task table differs between iOS and Android, making it impossible to use a backup from one platform on another.

To Reproduce

Steps to reproduce the behavior:

  1. Use the FlutterDownloader plugin to download files on an iOS device.
  2. Backup the download_tasks.db file from the iOS device.
  3. Restore the download_tasks.db file to an Android device.
  4. Call FlutterDownloader.loadTasks() on the Android device.
  5. Observe the error.

Expected behavior

The plugin should handle the restored database without errors. The task table schema should be consistent across platforms (iOS and Android).

Screenshots

NA

Device information:

[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B91 darwin-x64, locale en-GB)
• Flutter version 3.24.5 on channel stable at /Users/aungmyooo/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (4 weeks ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/aungmyooo/Library/Android/sdk
• Platform android-35, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.95.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0

[✓] Connected device (4 available)
• SM N975F (mobile) • adb-RF8M82Y3K9A-ktA2Cf._adb-tls-connect._tcp • android-arm64 • Android 12 (API 31)
• Aung Myo’s iPhone (mobile) • 00008120-0006612E0198A01E • ios • iOS 18.1.1 22B91
• macOS (desktop) • macos • darwin-x64 • macOS 15.1.1 24B91 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.109

[✓] Network resources
• All expected network resources are available.

• No issues found!

Additional context

@alexaungmyooo alexaungmyooo added the bug Something isn't working label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant