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 eb034333
authored
Apr 05, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for mysql comment + references. Closes #1521
1 parent
791990dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
lib/dialects/mysql/query-generator.js
test/dao-factory.test.js
lib/dialects/mysql/query-generator.js
View file @
eb03433
...
...
@@ -325,6 +325,10 @@ module.exports = (function() {
template
+=
" PRIMARY KEY"
}
if
(
dataType
.
comment
&&
Utils
.
_
.
isString
(
dataType
.
comment
)
&&
dataType
.
comment
.
length
)
{
template
+=
" COMMENT "
+
this
.
escape
(
dataType
.
comment
)
}
if
(
dataType
.
references
)
{
template
+=
" REFERENCES "
+
this
.
quoteTable
(
dataType
.
references
)
...
...
@@ -344,10 +348,6 @@ module.exports = (function() {
}
if
(
dataType
.
comment
&&
Utils
.
_
.
isString
(
dataType
.
comment
)
&&
dataType
.
comment
.
length
)
{
template
+=
" COMMENT "
+
this
.
escape
(
dataType
.
comment
)
}
result
[
name
]
=
template
}
else
{
result
[
name
]
=
dataType
...
...
test/dao-factory.test.js
View file @
eb03433
...
...
@@ -1679,6 +1679,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
done
()
})
})
it
(
"works with comments"
,
function
(
done
)
{
// Test for a case where the comment was being moved to the end of the table when there was also a reference on the column, see #1521
var
Member
=
this
.
sequelize
.
define
(
'Member'
,
{})
,
Profile
=
this
.
sequelize
.
define
(
'Profile'
,
{
id
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
,
references
:
Member
,
referencesKey
:
'id'
,
autoIncrement
:
false
,
comment
:
'asdf'
}
})
this
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
done
()
})
})
})
describe
(
"syntax sugar"
,
function
()
{
...
...
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