-
-
Notifications
You must be signed in to change notification settings - Fork 249
[Bug]: Upgrading to 5.0 will re-run sqlite import even if previously imported, deleting all existing data #727
Description
Describe the bug
TL;DR: Data loss will occur if you leave `massCode.db
It looks like the first-run of 5.0 checks if the massCode.db SQLite db still exists and, if so, will run the import/conversion to the Markdown file storage schema.
It does not check if this import/conversion was previously run and will delete anything in the .\markdown-vault folder.
In my case, I completed the import on version 4.7.1; for whatever reason my massCode.db file remained in my massCode data folder:
.\masscode\massCode.db
.\masscode\markdown-vault\.masscode\state.json
.\masscode\markdown-vault\PowerShell\.masscode-folder.yml
.\masscode\markdown-vault\PowerShell\Convert Masscode Snippets to Windows Terminal Snippets.md
[etc...]
My .\markdown-vault folder was completely wiped (without any user prompt or alert) and all additions and modifications to snippets that were done after migrating from the SQLite database format were completely lost.
My folder structure now looks like:
.\masscode\massCode.db
.\masscode\markdown-vault\code\.masscode\state.json
.\masscode\markdown-vault\code\PowerShell\Old-out-of-date-snippet.md
.\masscode\markdown-vault\notes\.masscode\state.json
[etc...]
To reproduce
My lifecycle steps:
- Install massCode version 4.4.0 (defaults to SQLite for the data storage format)
- Add new snippets
- Install massCode version 4.7.1
- Add/modify/delete snippets
- Manually convert from SQLite to Markdown data storage format using settings option
- Add/modify/delete snippets
- Install massCode 5.0.0
- Find all snippet changes since step 4 are lost
My test repo steps:
After installing massCode 5.0.0
- Quit massCode
- Restore
.\masscode\markdown-vaultfolder to pre-5.0.0 state - Confirm
.\masscode\assCode.dbstill exists (this file has remained in place and unmodified since my initial upgrade) - Launch massCode 5.0.0
- Observe masscode.exe open and access
.\masscode\massCode.db - Observe masscode.exe move files from
.\masscode\markdown-vault\EXAMPLE-NEW-DIR\EXAMPLE-NEW-SNIPPET.mdto.\masscode\markdown-vault\code\EXAMPLE-NEW-DIR\EXAMPLE-NEW-SNIPPET.md - Observe masscode.exe delete file
.\masscode\markdown-vault\code\EXAMPLE-NEW-DIR\EXAMPLE-NEW-SNIPPET.md - Observe masscode.exe create file
.\masscode\markdown-vault\code\EXAMPLE-OLD-DIR\EXAMPLE-OLD-SNIPPET.md
File actions were observed & confirmed via OS-level process monitoring
App Version and Architecture
5.0.0
System info
Windows 11Validations
- Follow our Code of Conduct
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.