-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
How to backup Isar db in a cloud storage? #579
Comments
This highly depends on your use case. You can use the |
I was thinking of backing up the full isar db in a cloud storage. For instance, if I use sqlite3, there is a single db file that can uploaded to cloud storage either daily or weekly. I think copyToFile might be suitable but I could not find |
Isar is also just one file. Here is the method (you need the newest version): https://pub.dev/documentation/isar/3.0.0-dev.10/isar/Isar/copyToFile.html |
I can also open the compacted database as usual using Isar.open(directory: /backup_db.isar) and Isar db single file is .isar file right? |
Correct! |
Thank you for helping me understand isar a bit more. Great work on isar. Hoping to integrate isar on an existing app. |
i have error when i try to open my file backup isar on directory
anyone can help this issue ? this is mycode :
|
Same here, any update on that? |
directory: (here should be the directory that contains that file not the file itself) |
@mysticeti, @abdullahalamodi How to backup Isar Db in File Storage, using copyToFile()? //Getting user specified path using FilePicker Package
String? path = await FilePicker.platform.getDirectoryPath();
//Create an empty file on that path
final emptyFile=File(path);
//Now copy isar db to this emptyFile
final isar = await ref.watch(isarProvider.future);
isar.copyToFile(emptyFile.path)); Though the user specified folder is empty, IsarError says that the file is exists. Is there any better way to backup Isar DB file in Local Storeage using copyToFile()? |
Since this is a closed issue, I would suggest not to add message here. Please use discussions section https://github.com/isar/isar/discussions have questions or the issues section if you want to file something related to isar. Code for opening saved isar file. You can call the below function once only ideally during app startup in main.dart.
Isar model for settings Code for saving isar db in file storage locally, the below function is receiving a settings state model which would then be translated into isar obj and stored. ` Future saveCurrentSettings( final settingsIsarObj = SettingsIsar() await isarDB.writeTxn(() async {
}); For cloud backup, you can use firestore or an object storage such as firebase storage storing db file as json. |
Hi
I am currently researching for a db to be used in a simple app where backup of the db to a cloud storage(s3 or firebase storage) is necessary. Is it possible to backup isar db and if so how to do it? Could not find anything related to it in the doc.
Thanks
The text was updated successfully, but these errors were encountered: