Self-taught software developer (he/him)
Programming @programming.dev A Brief, Incomplete, and Mostly Wrong History of Programming Languages
Programming @programming.dev Image Stacks and iPhone Racks - Building an Internet Scale Meme Search Engine
DATATERM @dataterm.digital Just need a Cyberdeck to access the DATATERM
Programming @programming.dev The Architecture of Nginx
Hello. Appreciate your question. I think that this is a good use case for the Repository Pattern.
In your case, this might look something like this:
You can consult the Design Patterns / Gang of Four book for more details
Off topic, but personally I don't feel you should worry too much about having to change the database in the future. I have rarely seen it happen in my career.