Skip to content

Commit

Permalink
Database connections now always have UTC timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
tg666 committed Oct 23, 2023
1 parent 1f4610c commit c865f35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Changed
- Database connections now always have UTC timezone.

## 0.5.2 - 2023-10-18
### Added
Expand Down
9 changes: 9 additions & 0 deletions src/model/database-client-factory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export function createDatabaseClient({ dbUrl }) {
max: 10,
acquireTimeoutMillis: 60000,
idleTimeoutMillis: 600000,
afterCreate: async (connection, done) => {
try {
await connection.query('SET timezone="UTC";');

done(null, connection);
} catch (err) {
done(err, connection);
}
},
},
});
}

0 comments on commit c865f35

Please sign in to comment.