Binner icon indicating copy to clipboard operation
Binner copied to clipboard

[Bug]: Backup/Restore is not system agnostic

Open jingsno opened this issue 11 months ago • 3 comments

Binner version

v2.6.0

Operating System

Windows -> Ubuntu

Describe the bug and the steps to reproduce it

The Backup/Restore function is not system agnostic. If I use a .bak backup file from a Windows install, and try to restore it on a Ubuntu install, the software states "Binner restored successfully!", but no data is restored correctly. (This is due to different filenames/paths between the versions, but if this is fixed, we might run into #236 aswell.)

If I check my Ubuntu install, I can see that the "Binner.bak" file is restored as "binner.db " (Note the extra space). The appsettings.json is restored correctly, but it contains references to "C:\Binner", specifically:

"Filename": "C:\\Binner\\binner.db",
"UserUploadedFilesPath": "C:\\Binner\\UserFiles"

When the Binner service is restartet on the Ubuntu install, it created the empty database FILE "C:\Binner\binner.db" and uses that instead of binner.db

It also creates a "C:\Binner\UserFiles" directory

The original appsettings.json had "Filename": "./binner.db " "UserUploadedFilesPath": "./UserFiles"

If I rename the "binner.db " (Note the extra space) file to the correct name "binner.db", and fix the appsettings.json paths while the service is stopped, the restore works, and the inventory is working/populated.

Would you like to attach your appsetings.json configuration?

No response

Screenshots or Videos (Optional, but they help!)

Screenshot 2023-07-23 133023

Are you able to contribute a PR? (No is ok!)

None

jingsno avatar Jul 23 '23 13:07 jingsno

Note that in the screenshot above, the "binner.db " file with an empty space, is just observable on the bottom. (I uploaded the screenshot before I figured out what was actually happening)

jingsno avatar Jul 23 '23 13:07 jingsno

got it - yes I don't think I accounted for doing a backup/restore across different operating systems. I'll rereview the current process and see if I can come up with a better way to handle it.

replaysMike avatar Apr 22 '24 20:04 replaysMike

this is a little more tricky to accomplish, as the backup contains your settings file appsettings.json which is configured for Windows, however it's being restored on a Unix environment and isn't aware of that. It's simply going to overwrite the existing appsettings.json from the restore. It's also possible in this scenario that your Unix environment is configured for a different storage provider, and it can't restore the database to a different provider.

The quick fix would be to update the paths in the appsettings.json after restoring, but before restarting the service so they are correct when it starts up.

I think a longer term approach would be to export things to an intermediary format like CSV (how it used to work) but it gets complicated fast. I'll have to save something like this for a future major update, as there is no quick solution.

replaysMike avatar Apr 22 '24 21:04 replaysMike