From c090822e96819d62cfb8eabbd38ad084f37c6022 Mon Sep 17 00:00:00 2001 From: Max Polsky Date: Tue, 5 Dec 2023 12:59:41 +0200 Subject: [PATCH] Fix column type in postgres schema translator --- libs/external-db-postgres/src/sql_schema_translator.spec.ts | 2 +- libs/external-db-postgres/src/sql_schema_translator.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/external-db-postgres/src/sql_schema_translator.spec.ts b/libs/external-db-postgres/src/sql_schema_translator.spec.ts index c09f4b7d4..637c0e038 100644 --- a/libs/external-db-postgres/src/sql_schema_translator.spec.ts +++ b/libs/external-db-postgres/src/sql_schema_translator.spec.ts @@ -54,7 +54,7 @@ describe('Sql Schema Column Translator', () => { describe('string fields', () => { test('string', () => { - expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeIdentifier(ctx.fieldName)} varchar(2048)`) + expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeIdentifier(ctx.fieldName)} text`) }) test('string with length', () => { diff --git a/libs/external-db-postgres/src/sql_schema_translator.ts b/libs/external-db-postgres/src/sql_schema_translator.ts index 0966a06d1..d26421acc 100644 --- a/libs/external-db-postgres/src/sql_schema_translator.ts +++ b/libs/external-db-postgres/src/sql_schema_translator.ts @@ -97,7 +97,7 @@ export default class SchemaColumnTranslator { return 'timestamp' case 'text_string': - return `varchar${this.parseLength(precision)}` + return precision ? `varchar${this.parseLength(precision)}` : 'text' case 'text_small': case 'text_medium':