Skip to content

Commit

Permalink
fix: remove knex file from database folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Kpoke committed Mar 15, 2022
1 parent e96b93a commit a635b1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
26 changes: 0 additions & 26 deletions database/knex.js

This file was deleted.

19 changes: 13 additions & 6 deletions server/database/knex.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
require('dotenv').config();
const expect = require('expect-runtime');
const knex = require('knex');
const log = require('loglevel');
const connection = require('../../config/config').connectionString;

expect(connection).to.match(/^postgresql:\//);

const knexConfig = {
client: 'pg',
debug: process.env.NODE_LOG_LEVEL === 'debug',
connection: process.env.DATABASE_URL,
pool: { min: 0, max: 100 },
connection,
pool: {
min: 0,
max: 100,
},
};

log.debug(process.env.DATABASE_SCHEMA);
if (process.env.DATABASE_SCHEMA) {
log.info('setting a schema');
knexConfig.searchPath = [process.env.DATABASE_SCHEMA, 'public'];
knexConfig.searchPath = [process.env.DATABASE_SCHEMA];
}
log.debug(knexConfig.searchPath);

const knex = require('knex')(knexConfig);

module.exports = knex;
module.exports = knex(knexConfig);

0 comments on commit a635b1c

Please sign in to comment.