torrust-tracker icon indicating copy to clipboard operation
torrust-tracker copied to clipboard

Overhaul persistence

Open josecelano opened this issue 6 months ago • 1 comments

We should review the database layer.

Context

Problem

  • I'm not sure if the package we are using is still the best fit for this project.
  • I think we should include migrations if we start making schema changes more often, and it seems we will. For example, I'm planning to add more tables to persist metrics. See https://github.com/torrust/torrust-tracker/issues/1437#issuecomment-2887185631

Proposal

In the middle term (before adding more tables), we should:

  • Research to confirm if the current crate is the best one. Change it if it's not.
  • Add migrations.
  • Split the database trait into many different traits per context. Otherwise, it will end up having too many methods.

I think I will implement the metrics persistence with the current drivers because I want to finish the stats overhaul, but we should consider implementing this epic before continuing to add more tables (complexity) to the current persistence layer, especially if we decide to change it.

cc @da2ce7

josecelano avatar May 16 '25 16:05 josecelano