Skip to content

Commit

Permalink
chore(api): switch db connections to mysql2 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak authored Nov 14, 2021
1 parent ee8cb0d commit cd2315a
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 56 deletions.
126 changes: 74 additions & 52 deletions packages/spelunker-api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/spelunker-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"globby": "^10.0.2",
"graphql": "^14.7.0",
"knex": "^0.21.19",
"mysql": "^2.18.1",
"mysql2": "^2.3.2",
"pngjs": "^6.0.0"
},
"devDependencies": {
Expand Down
15 changes: 12 additions & 3 deletions packages/spelunker-api/src/lib/db/connections.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import knex from 'knex';

const authConnection = knex(process.env.DATABASE_AUTH_URI);
const charactersConnection = knex(process.env.DATABASE_CHARACTERS_URI);
const worldConnection = knex(process.env.DATABASE_WORLD_URI);
const authConnection = knex({
client: 'mysql2',
connection: process.env.DATABASE_AUTH_URI,
});
const charactersConnection = knex({
client: 'mysql2',
connection: process.env.DATABASE_CHARACTERS_URI,
});
const worldConnection = knex({
client: 'mysql2',
connection: process.env.DATABASE_WORLD_URI,
});

export {
authConnection,
Expand Down

0 comments on commit cd2315a

Please sign in to comment.