From dc784812ac9f8db805eadbe897cc17c78fbed329 Mon Sep 17 00:00:00 2001 From: Cameron Paczek Date: Thu, 19 Jan 2023 14:41:32 -0800 Subject: [PATCH] Remove PG Magic Numbers --- .../core/database/lib/dialects/postgresql/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/database/lib/dialects/postgresql/index.js b/packages/core/database/lib/dialects/postgresql/index.js index b865534f4f..431f452eaf 100644 --- a/packages/core/database/lib/dialects/postgresql/index.js +++ b/packages/core/database/lib/dialects/postgresql/index.js @@ -16,8 +16,16 @@ class PostgresDialect extends Dialect { } async initialize() { - this.db.connection.client.driver.types.setTypeParser(1082, 'text', (v) => v); // Don't cast DATE string to Date() - this.db.connection.client.driver.types.setTypeParser(1700, 'text', parseFloat); + this.db.connection.client.driver.types.setTypeParser( + this.db.connection.client.driver.types.builtins.DATE, + 'text', + (v) => v + ); // Don't cast DATE string to Date() + this.db.connection.client.driver.types.setTypeParser( + this.db.connection.client.driver.types.builtins.NUMERIC, + 'text', + parseFloat + ); } usesForeignKeys() {