suroh
1 year ago
9 changed files with 1032 additions and 187 deletions
@ -1,23 +1,13 @@ |
|||
import knexConfig from '../knexfile.js' |
|||
import Knex from 'knex' |
|||
import { Model } from 'objection' |
|||
import { newDb } from 'pg-mem' |
|||
|
|||
const environment = process.env.NODE_ENV || 'development' |
|||
|
|||
// variable for exporting the db
|
|||
let DB |
|||
|
|||
if (environment == 'test') { |
|||
const mem = newDb() |
|||
DB = mem.adapters.createKnex(0, { |
|||
migrations: { |
|||
directory: './db/migrations' |
|||
}, |
|||
}) |
|||
Model.knex(DB) |
|||
} else { |
|||
DB = Knex(knexConfig[environment]) |
|||
} |
|||
DB = Knex(knexConfig[environment]) |
|||
Model.knex(DB) |
|||
|
|||
export default DB |
|||
|
File diff suppressed because it is too large
@ -1,24 +0,0 @@ |
|||
# Logs |
|||
logs |
|||
*.log |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
pnpm-debug.log* |
|||
lerna-debug.log* |
|||
|
|||
node_modules |
|||
dist |
|||
dist-ssr |
|||
*.local |
|||
|
|||
# Editor directories and files |
|||
.vscode/* |
|||
!.vscode/extensions.json |
|||
.idea |
|||
.DS_Store |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw? |
Loading…
Reference in new issue