ockam
ockam copied to clipboard
Have a single `SqlxDatabase` instance per process
Current behavior
There are some places where we are creating multiple SqlxDatabase
instances, like here.
Desired behavior
The SqlxDatabse
struct should be created once per db file/process (we currently have only one db file).
One way to achieve this would be to add a OnceLock
inside the SqlxDatabase
struct so that it gets initialized only once in the create
function.
Another approach would be to investigate how can we refactor the creation of the database instance so it's just created once. That would mean detecting all the places where we are creating the database object multiple times and refactoring them accordingly.
@nazmulidris
I want to try this issue. Would it be possible for you to assign this to me?
@u-na-gi That's awesome, this is all yours. Please let us know if you have any questions as you explore. You can also ask questions on the contributors discord https://discord.ockam.io