不要怂,就是干,撸起袖子干!

Commit 20f7eb43 by Michael Yates Committed by Sushant

fix(postgres/query-generator): syntax error with auto-increment SMALLINT (#9406)

1 parent f0ae18d6
...@@ -843,6 +843,9 @@ const QueryGenerator = { ...@@ -843,6 +843,9 @@ const QueryGenerator = {
if (_.includes(dataType, 'BIGINT')) { if (_.includes(dataType, 'BIGINT')) {
dataType = dataType.replace(/SERIAL/, 'BIGSERIAL'); dataType = dataType.replace(/SERIAL/, 'BIGSERIAL');
dataType = dataType.replace(/BIGINT/, ''); dataType = dataType.replace(/BIGINT/, '');
} else if (_.includes(dataType, 'SMALLINT')) {
dataType = dataType.replace(/SERIAL/, 'SMALLSERIAL');
dataType = dataType.replace(/SMALLINT/, '');
} else { } else {
dataType = dataType.replace(/INTEGER/, ''); dataType = dataType.replace(/INTEGER/, '');
} }
......
...@@ -137,8 +137,12 @@ if (dialect.match(/^postgres/)) { ...@@ -137,8 +137,12 @@ if (dialect.match(/^postgres/)) {
createTableQuery: [ createTableQuery: [
{ {
arguments: ['myTable', {int: 'INTEGER', bigint: 'BIGINT'}], arguments: ['myTable', {int: 'INTEGER', bigint: 'BIGINT', smallint: 'SMALLINT' }],
expectation: 'CREATE TABLE IF NOT EXISTS \"myTable\" (\"int\" INTEGER, \"bigint\" BIGINT);' expectation: 'CREATE TABLE IF NOT EXISTS \"myTable\" (\"int\" INTEGER, \"bigint\" BIGINT, \"smallint\" SMALLINT);'
},
{
arguments: ['myTable', {serial: 'INTEGER SERIAL', bigserial: 'BIGINT SERIAL', smallserial: 'SMALLINT SERIAL' }],
expectation: 'CREATE TABLE IF NOT EXISTS \"myTable\" (\"serial\" SERIAL, \"bigserial\" BIGSERIAL, \"smallserial\" SMALLSERIAL);'
}, },
{ {
arguments: ['myTable', {title: 'VARCHAR(255)', name: 'VARCHAR(255)'}], arguments: ['myTable', {title: 'VARCHAR(255)', name: 'VARCHAR(255)'}],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!