Skip to content
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

feat: add sqlite backend for storage #483

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cocool97
Copy link
Contributor

@cocool97 cocool97 commented Jan 4, 2025

This PR aims to add a SQLite backend for server storage. It is provided as a replacement of jsonDB and bboltDB. This new storage is currently registered as the default backend.

gorm (https://gorm.io/) is used as an ORM, allowing to abstract models and underlying database storage (MySQL, PostgreSQL, SQLite, SQLite server). Only SQLite is implemented in this PR.

A new parameter has also been added to server CLI, -b to continue using "legacy" storage backends.

Advantages of this new storage backend:

  • Less memory fingerprint (no information is stored in memory, everything is store on disk).
  • A complete and structured request language (SQL), providing interesting features for requests.
  • Defined models to create and migrate database

Settings are still stored in JSON format, easing the pre-configuration of the server.

This PR is needed for #421 to cache downloaded informations about films and series using TMDB api. This will prevent reaching quota by caching informations, without impact on memory consumption.

Needed steps before PR being ready:

  • Add SQLite storage
  • Store torrent
  • Store viewed information

Let me know if there is something I can do to improve this PR !

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