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

add support for postgresql as an alternative to mysql #25

Open
davehorton opened this issue Jan 11, 2024 · 2 comments
Open

add support for postgresql as an alternative to mysql #25

davehorton opened this issue Jan 11, 2024 · 2 comments

Comments

@davehorton
Copy link
Contributor

It would be nice to give customers a choice of postgresql or mysql for the jambonz provisioning database. This would mean changes here but also in feature server and some other apps

@radicaldrew
Copy link

radicaldrew commented Nov 7, 2024

I have used the Sequelize package in order to accomplish this.
This requires changing the connection in the index file then updating every single query in the lib folder.
You can see example changes on lib for this to happen here:
https://github.com/radicaldrew/db-helpers/blob/main/lib/lookup-auth-hook.js

You can see example connections
https://github.com/radicaldrew/db-helpers/blob/main/index.js

Issue with this is backwards compatibility
I think we need to keep the original JAMBONES_MYSQL_ prefix.
Then add JAMBONES_POSTGRES_ prefix and allow either postgres or mysql for dialect

@radicaldrew
Copy link

radicaldrew commented Nov 14, 2024

I have updated the proposed db-helpers.
the only issue going forward is from the application side.
For example in the api server, all mysql environment variables are still there.
This code will work as they are just arguments.

environment variables:
new JAMBONES_DB_DIALECT - mysql or postgres ( default mysql )
new JAMBONES_DB_CA_CERT - gives the ability to use SSL certificate for mysql
JAMBONES_MYSQL_WRITE_HOST
JAMBONES_MYSQL_WRITE_USER
JAMBONES_MYSQL_WRITE_PASSWORD
JAMBONES_MYSQL_WRITE_DATABASE
JAMBONES_MYSQL_WRITE_PORT

new JAMBONES_POSTGRES_WRITE_HOST
new JAMBONES_POSTGRES_WRITE_USER
new JAMBONES_POSTGRES_WRITE_PASSWORD
new JAMBONES_POSTGRES_WRITE_DATABASE
new JAMBONES_POSTGRES_WRITE_HOST
new JAMBONES_POSTGRES_WRITE_PORT

Latest version of the code:
https://github.com/radicaldrew/db-helpers/blob/main/index.js

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

No branches or pull requests

2 participants