Repository navigation
fix(connections): removing a folder keeps its connections - #1267
Merged
Merged
Conversation
connections.folder_id cascades on delete, so removing a folder deleted the connections in it. They are detached (folder_id = NULL) in the same transaction before the folder row goes, so the cascade finds nothing. No schema migration: the foreign key stays as it is. The confirmation dialog and the secret cleanup of the previous change are gone: nothing is deleted any more.
The sidebar reloads from the database after the save; checking once raced it. The URI scenarios already waited.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces the behaviour #1266 made visible: removing a folder no longer deletes its connections; they stay in the list without a folder.
Why this way:
connections.folder_idisON DELETE CASCADE. Changing it toSET NULLmeans rebuilding theconnectionstable in SQLite (a migration of the user's main table). Instead,LocalDb.removeFoldersetsfolder_id = NULLon the folder's connections and deletes the folder in one transaction. The cascade then finds nothing. No schema change, no migration, nothing to roll back.Removed, as nothing is destroyed any more: the confirmation dialog and the secret cleanup from #1266.
Tests: connections of the removed folder survive with
folder_idnull and keep their password in the secure store; another folder's connections are untouched; removing an empty or unknown folder is harmless.Existing databases are unaffected; the old cascade stays in the schema but is never triggered through the app.
Test plan