From d8b6c4757ec5346b614ac98d4d6ab7561f72c411 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Wed, 29 May 2019 12:55:55 +0200 Subject: [PATCH] fix(core): Fix postgres error when specifying custom fields For now I have just made all custom fields nullable. In future (see #85) there will be more control over this in the custom field config. Fixes #101 --- packages/core/src/entity/custom-entity-fields.ts | 2 +- packages/dev-server/dev-config.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/entity/custom-entity-fields.ts b/packages/core/src/entity/custom-entity-fields.ts index 7f5b6f6e1b..749dd2cc6b 100644 --- a/packages/core/src/entity/custom-entity-fields.ts +++ b/packages/core/src/entity/custom-entity-fields.ts @@ -58,7 +58,7 @@ function registerCustomFieldsForEntity( for (const customField of customFields) { const { name, type } = customField; const registerColumn = () => - Column({ type: getColumnType(dbEngine, type), name })(new ctor(), name); + Column({ type: getColumnType(dbEngine, type), name, nullable: true })(new ctor(), name); if (translation) { if (type === 'localeString') { diff --git a/packages/dev-server/dev-config.ts b/packages/dev-server/dev-config.ts index 717243ca32..a5e7aad72f 100644 --- a/packages/dev-server/dev-config.ts +++ b/packages/dev-server/dev-config.ts @@ -66,6 +66,7 @@ function getDbConfig(): ConnectionOptions { case 'postgres': console.log('Using postgres connection'); return { + synchronize: true, type: 'postgres', host: '127.0.0.1', port: 5432, @@ -83,6 +84,7 @@ function getDbConfig(): ConnectionOptions { default: console.log('Using mysql connection'); return { + synchronize: true, type: 'mysql', host: '192.168.99.100', port: 3306,