Skip to content

Commit

Permalink
revert: revert field size
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Nov 28, 2023
1 parent 67399e5 commit 26cc542
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 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(65535)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeId(ctx.fieldName)} VARCHAR(2048)`)
})

test('string with length', () => {
Expand Down
4 changes: 2 additions & 2 deletions libs/external-db-mssql/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ export default class SchemaColumnTranslator {
try {
const parsed = parseInt(length as string)
if (isNaN(parsed) || parsed <= 0) {
return '(65535)'
return '(2048)'
}
return `(${parsed})`
} catch (e) {
return '(65535)'
return '(2048)'
}
}

Expand Down
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(65535)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeId(ctx.fieldName)} VARCHAR(2048)`)
})

test('string with length', () => {
Expand Down
4 changes: 2 additions & 2 deletions libs/external-db-mysql/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ export default class SchemaColumnTranslato {
try {
const parsed = parseInt(length)
if (isNaN(parsed) || parsed <= 0) {
return '(65535)'
return '(204865535)'
}
return `(${parsed})`
} catch (e) {
return '(65535)'
return '(2048)'
}
}

Expand Down
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(65535)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeIdentifier(ctx.fieldName)} varchar(2048)`)
})

test('string with length', () => {
Expand Down
4 changes: 2 additions & 2 deletions libs/external-db-postgres/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ export default class SchemaColumnTranslator {
try {
const parsed = parseInt(length)
if (isNaN(parsed) || parsed <= 0) {
return '(65535)'
return '(2048)'
}
return `(${parsed})`
} catch (e) {
return '(65535)'
return '(2048)'
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/external-db-spanner/src/sql_schema_translator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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)} STRING(65535)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'string' }) ).toEqual(`${escapeId(ctx.fieldName)} STRING(2048)`)
})

test('string with length', () => {
Expand All @@ -76,7 +76,7 @@ describe('Sql Schema Column Translator', () => {
})

test('text language', () => {
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'language' }) ).toEqual(`${escapeId(ctx.fieldName)} STRING(65535)`)
expect( env.schemaTranslator.columnToDbColumnSql({ name: ctx.fieldName, type: 'text', subtype: 'language' }) ).toEqual(`${escapeId(ctx.fieldName)} STRING(2048)`)
})
})

Expand Down
4 changes: 2 additions & 2 deletions libs/external-db-spanner/src/sql_schema_translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ export default class SchemaColumnTranslator implements ISpannerSchemaColumnTrans
try {
const parsed = parseInt(length as string)
if (isNaN(parsed) || parsed <= 0) {
return '(65535)'
return '(2048)'
}
return `(${parsed})`
} catch (e) {
return '(65535)'
return '(2048)'
}
}

Expand Down

0 comments on commit 26cc542

Please sign in to comment.