Skip to content

Migration/db indexeddb to sqlite#97

Merged
RafaUC merged 20 commits into
masterfrom
migration/db-indexeddb-to-sqlite
Feb 7, 2026
Merged

Migration/db indexeddb to sqlite#97
RafaUC merged 20 commits into
masterfrom
migration/db-indexeddb-to-sqlite

Conversation

@RafaUC
Copy link
Copy Markdown
Owner

@RafaUC RafaUC commented Feb 7, 2026

This PR implements a backend and database migration from Dexie to SQLite3 using Better-sqlite3 and Kysely, achieving better performance and scalability in general. This also adds several enhanced features now possible thanks to this migration.

New Features: 

  • Modeled and created the new SQLite database and a new migrations workflow.
  • Implemented all the requirements for the backend class and the Backup-Scheduler to run on SQLite and inside a web worker to prevent them from freezing the renderer thread.
  • Automatic database migration from the old database format to the new SQLite database.
  • Support to restore database from both the old JSON format backups and the new SQLite file backups
  • Add complete support for nested criteria and conjunctions in advanced searches and updated related components.
  • Add the possibility to use any subset of a query as a subquery through the saved searches panel.
  • Add an option to the tag context menu to update a tag file count and save the cached count as a property to it.
    • Remove the "Load file counts at startup" setting.

Optimizations:

  • Add bidirectional cursor pagination for infinite-like scroll, now the app only loads a set of files on each change of view and loads more as it needs, while keeping the infinite scroll behavior and refactoring several components and methods to still support the features the app always supported.
    • Now you can press pg-up and pg-down to go to the edges of the loaded files in view.
    • Use the Home and End keys to go to the top and bottom of the filtered files in view.
  • Created optimized backend methods for bulk tagging and tag removal for files filtered by criteria.
  • Replaced all operations on file selection with contextual methods that dispatch the operation to the current selection or to all filtered files in batches.

…migrations

Create Tag table schemas to test Kysely.
- Implement backend fetch methods.

- Implement support for conjunction per criteria in search files.

- Implement optional startup of the backend as a web worker.

- Add a small delay before a heavy fetch in average to ensure loading animations start before the backend blocks the render thread, improving UX.
implement create and save methods and all the other interface methods.
…eries. Implements #69

  - Reworked advanced search editor to edit conjunctions  and nesting in groups.

  - Reworked saved searches panel to show and use sub-queries and sub-criteria.
…gration bugs for the backend in worker mode, and set them to always work in worker mode.
…sing for heavy database tasks. Fixes #86

This commit implements some refactors and new features aiming to enable the app to scale much better with larger gallery libraries. This should significantly reduce memory usage, improve loading times, and prevent app freezes or crashes when handling a huge amount of files. Now the app should be able to scale almost unlimitedly, the only limits being disk space and time when computing transversal operations across all records.

- Implemented bidirectional cursor pagination in all the views except for missing files, now the app loads the files it needs when reaching the edges of the scroll instead of loading all the files in the view.

- Implement a batch processor in an accumulator pattern to process huge sets of files, and refactor all the features that did a fetch-all to use it instead.

- Implement specialized backend queries to compare added files, missing files and missing files reconciliation when manually syncing locations.

- Refactored scroll positioning methods to work with the new fetching method.
…oaded in the main view fileList.

- Created optimized backend methods for bulk tagging and tag removal for files filtered by criteria.

- Replaced all operations on file selection with contextual methods that dispatch the operation to the current selection or to all filtered files in batches.
…axvars limit was exceeded, now upsert methods insert in batches.

- Added a cached fileCount to each tag, and removed ovservable based calculations.

- Implemented batch based methods to update file counts to all or any sub set of tags.

- Remove the Load tag file counts at startup option.
@RafaUC RafaUC merged commit 982bddc into master Feb 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant