Skip to content

Commit

Permalink
Fix text_string column type in mssql schema
Browse files Browse the repository at this point in the history
translator
  • Loading branch information
MXPOL committed Dec 5, 2023
1 parent c090822 commit b7d65e8
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-mssql/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-mssql/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class SchemaColumnTranslator {
return 'SMALLDATETIME'

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 b7d65e8

Please sign in to comment.