feat: choose schema via process.env.DB_SCHEMA

This commit is contained in:
dancingCycle 2023-11-17 12:01:58 +01:00
parent 5815ff3008
commit bb9e2ca050
1 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,15 @@
const debug=require('debug')('debug');
require('dotenv').config();
const db = require('./db');
async function get() {
const schema = process.env.DB_SCHEMA || 'schema';
debug('schema: ' + schema );
const DATA = await db.query(
'SELECT agency.agency_id,agency.agency_name FROM agency');
'SELECT agency.agency_id, agency.agency_name FROM ' + schema + '.agency');
return DATA;
}
module.exports = {