Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 20f7eb43
authored
May 07, 2018
by
Michael Yates
Committed by
Sushant
May 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(postgres/query-generator): syntax error with auto-increment SMALLINT (#9406)
1 parent
f0ae18d6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
lib/dialects/postgres/query-generator.js
test/unit/dialects/postgres/query-generator.test.js
lib/dialects/postgres/query-generator.js
View file @
20f7eb4
...
@@ -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/
,
''
);
}
}
...
...
test/unit/dialects/postgres/query-generator.test.js
View file @
20f7eb4
...
@@ -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)'
}],
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment