Skip to content

Commit

Permalink
Fix column type in postgres schema translator
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Dec 5, 2023
1 parent ae48b91 commit c090822
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion libs/external-db-postgres/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit c090822

Please sign in to comment.