Browse Source

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
Michael Bromley 6 years ago
parent
commit
d8b6c4757e

+ 1 - 1
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') {

+ 2 - 0
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,