Skip to content

Commit

Permalink
Fix column type in SQL schema translator
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Dec 5, 2023
1 parent 41767c0 commit ae48b91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/external-db-mysql/src/sql_schema_translator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Sql Schema Column Translator', () => {

describe('string fields', () => {
test('string', () => {
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeId(ctx.fieldName)} VARCHAR(2048)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeId(ctx.fieldName)} TEXT`)
})

test('string with length', () => {
Expand Down
2 changes: 1 addition & 1 deletion libs/external-db-mysql/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class SchemaColumnTranslato {
return 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP'

case 'text_string':
return `VARCHAR${this.parseLength(precision)}`
return precision ? `VARCHAR${this.parseLength(precision)}` : 'TEXT'

case 'text_small':
case 'text_language':
Expand Down

0 comments on commit ae48b91

Please sign in to comment.