Skip to content

Commit

Permalink
fix(vercel): compat pgsql column case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming committed Mar 12, 2021
1 parent 7513a98 commit 613323c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/server/src/service/storage/postgresql.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ module.exports = class extends MySQL {
return super.model(tableName.toLowerCase());
}

async select(...args) {
const data = await super.select(...args);
return data.map(({insertedat, createdat, updatedat, ...item}) => {
const mapFields = {
insertedAt: insertedat,
createdAt: createdat,
updatedAt: updatedat
};
for(const field in mapFields) {
if(!mapFields[field]) {
continue;
}
item[field] = mapFields[field];
}
return item;
});
}

async count(...args) {
let result = await super.count(...args);
try {
Expand Down

0 comments on commit 613323c

Please sign in to comment.