mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-06 17:59:37 +00:00
refactor: adapt many sql queries for postgresql
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
const moment = require('moment');
|
||||
const moment = require('moment');
|
||||
const {isPostgres} = require('./config');
|
||||
const {ref} = require('objection');
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -45,6 +47,20 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Casts a column to json if using postgres
|
||||
*
|
||||
* @param {string} colName
|
||||
* @returns {string|Objection.ReferenceBuilder}
|
||||
*/
|
||||
castJsonIfNeed: function (colName) {
|
||||
if (isPostgres()) {
|
||||
return ref(colName).castText();
|
||||
}
|
||||
else {
|
||||
return colName;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user