Skip to content

Switching from sqlite to postgres #53

Answered by benbjohnson
Jimmy99 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Jimmy99. Good question. It depends if you need to support both SQLite & Postgres or if you're just moving to Postgres.

If you're moving to Postgres (and removing SQLite support) then I would create a postgres package for the code and update the sqlite references in cmd/wtfd/main.go. The other packages shouldn't have knowledge of the underlying implementation—only the main package that wires it all together.

If you're supporting both Postgres & SQLite, you could either add a postgres package and keep the sqlite package or you could look at implementing SQL support using some kind of generic ORM tool. In that case, I would move the code into a sql package that would support both.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by benbjohnson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants