Time unification
This commit is contained in:
@@ -5,7 +5,13 @@ const { Pool } = pg;
|
||||
let pool;
|
||||
|
||||
export function initPool(config) {
|
||||
pool = new Pool(config);
|
||||
pool = new Pool({
|
||||
// Pin the session timezone to business time (matches the
|
||||
// `ALTER DATABASE inventory_db SET timezone = 'America/Chicago'` default)
|
||||
// so a DB restore/migration can't silently revert date semantics.
|
||||
options: '-c TimeZone=America/Chicago',
|
||||
...config,
|
||||
});
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,10 @@ async function setupSshTunnel() {
|
||||
password: process.env.PROD_DB_PASSWORD,
|
||||
database: process.env.PROD_DB_NAME,
|
||||
port: Number(process.env.PROD_DB_PORT) || 3306,
|
||||
timezone: 'Z',
|
||||
// DATETIME columns store Central wall-clock literals — return them as
|
||||
// strings; parse with shared/business-time parseMySql() if instants are
|
||||
// ever needed (see docs/TIME.md).
|
||||
dateStrings: true,
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user