-
Notifications
You must be signed in to change notification settings - Fork 2
fix: DB path, import file picker blackout, and sync registry columns #36
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9d563cf
fix: move DB to Application Support, open file picker before confirma…
iamvirul 60b975f
fix: correct suppliers and customers sync column definitions
iamvirul 17b5512
docs: update changelog for DB path and sync registry fixes
iamvirul 7e747bf
fix: implement one-time migration for database file location and upda…
iamvirul c9055f0
fix: use conditional import for db connection to fix web build
iamvirul 111ab71
fix: copy WAL sidecars during legacy DB migration to preserve uncheck…
iamvirul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:drift/drift.dart'; | ||
| import 'package:drift/native.dart'; | ||
| import 'package:path/path.dart' as p; | ||
| import 'package:path_provider/path_provider.dart'; | ||
|
|
||
| QueryExecutor openAppDatabaseConnection() { | ||
| return LazyDatabase(() async { | ||
| final dir = await getApplicationSupportDirectory(); | ||
| final file = File(p.join(dir.path, 'bms_local.sqlite')); | ||
| // One-time migration: drift_flutter previously defaulted to Documents/. | ||
| // Copy the legacy file on first launch if the new location is empty. | ||
| if (!file.existsSync()) { | ||
| final docsDir = await getApplicationDocumentsDirectory(); | ||
| final legacy = File(p.join(docsDir.path, 'bms_local.sqlite')); | ||
| if (legacy.existsSync()) { | ||
| await legacy.copy(file.path); | ||
| // Copy WAL sidecars so committed-but-uncheckpointed data is not lost. | ||
| // SQLite replays and checkpoints the WAL automatically on next open. | ||
| for (final suffix in ['-wal', '-shm']) { | ||
| final sidecar = File('${legacy.path}$suffix'); | ||
| if (sidecar.existsSync()) { | ||
| await sidecar.copy('${file.path}$suffix'); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return NativeDatabase.createInBackground(file); | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import 'package:drift/drift.dart'; | ||
| import 'package:drift_flutter/drift_flutter.dart'; | ||
|
|
||
| QueryExecutor openAppDatabaseConnection() { | ||
| return driftDatabase( | ||
| name: 'bms_local', | ||
| web: DriftWebOptions( | ||
| sqlite3Wasm: Uri.parse('sqlite3.wasm'), | ||
| driftWorker: Uri.parse('drift_worker.js'), | ||
| ), | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.