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 7849eda0
authored
Nov 01, 2014
by
Jeff French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix addColumn query generation for enums in postgres.
1 parent
30c1c32e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
lib/dialects/postgres/query-generator.js
lib/dialects/postgres/query-generator.js
View file @
7849eda
...
@@ -175,17 +175,16 @@ module.exports = (function() {
...
@@ -175,17 +175,16 @@ module.exports = (function() {
addColumnQuery
:
function
(
table
,
key
,
dataType
)
{
addColumnQuery
:
function
(
table
,
key
,
dataType
)
{
var
query
=
'ALTER TABLE <%= table %> ADD COLUMN <%= attribute %>;'
var
query
=
'ALTER TABLE <%= table %> ADD COLUMN <%= attribute %>;'
,
dbDataType
=
this
.
attributeToSQL
(
dataType
,
{
context
:
'addColumn'
})
,
attribute
;
,
attribute
;
if
(
dataType
.
toString
()
===
DataTypes
.
ENUM
.
toString
())
{
if
(
(
dataType
.
type
&&
dataType
.
type
.
toString
()
===
DataTypes
.
ENUM
.
toString
())
||
dataType
.
toString
()
===
DataTypes
.
ENUM
.
toString
())
{
query
=
this
.
pgEnum
(
table
,
key
,
dataType
)
+
query
;
query
=
this
.
pgEnum
(
table
,
key
,
dataType
)
+
query
;
}
}
attribute
=
Utils
.
_
.
template
(
'<%= key %> <%= definition %>'
)({
attribute
=
Utils
.
_
.
template
(
'<%= key %> <%= definition %>'
)({
key
:
this
.
quoteIdentifier
(
key
),
key
:
this
.
quoteIdentifier
(
key
),
definition
:
this
.
attributeToSQL
(
dataType
,
{
definition
:
this
.
pgDataTypeMapping
(
table
,
key
,
dbDataType
)
context
:
'addColumn'
})
});
});
return
Utils
.
_
.
template
(
query
)({
return
Utils
.
_
.
template
(
query
)({
...
...
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