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 1c0a66af
authored
May 10, 2016
by
Angelo Paolo Obispo
Committed by
Jan Aagaard Meier
May 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes issue #5808 removeColumn tries to delete nonexistent foreign keys (#5851)
1 parent
c8da3c8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
changelog.md
lib/dialects/mysql/query-generator.js
test/integration/query-interface.test.js
changelog.md
View file @
1c0a66a
# Future
-
[
FIXED
]
Postgres DECIMAL precision. (PostgreSQL)
[
#4893
](
https://github.com/sequelize/sequelize/issues/4893
)
-
[
FIXED
]
removeColumn tries to delete non-existant foreign key constraint (mysql)
[
#5808
](
https://github.com/sequelize/sequelize/issues/5808
)
# 3.23.0
-
[
FIXED
]
Invalid query generated when using LIKE + ANY
[
#5736
](
https://github.com/sequelize/sequelize/issues/5736
)
...
...
lib/dialects/mysql/query-generator.js
View file @
1c0a66a
...
...
@@ -357,8 +357,11 @@ var QueryGenerator = {
return
[
'SELECT CONSTRAINT_NAME as constraint_name'
,
'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE'
,
'WHERE TABLE_NAME = '
+
wrapSingleQuote
(
tableName
),
'WHERE (REFERENCED_TABLE_NAME = '
+
wrapSingleQuote
(
tableName
),
'AND REFERENCED_COLUMN_NAME = '
+
wrapSingleQuote
(
columnName
),
') OR (TABLE_NAME = '
+
wrapSingleQuote
(
tableName
),
'AND COLUMN_NAME = '
+
wrapSingleQuote
(
columnName
),
')'
,
].
join
(
' '
);
},
...
...
test/integration/query-interface.test.js
View file @
1c0a66a
...
...
@@ -696,7 +696,7 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
it
(
'should get a list of foreign keys for the table'
,
function
()
{
var
sql
=
this
.
queryInterface
.
QueryGenerator
.
getForeignKeysQuery
(
'hosts'
,
this
.
sequelize
.
config
.
database
);
var
self
=
this
;
return
this
.
sequelize
.
query
(
sql
,
{
type
:
this
.
sequelize
.
QueryTypes
.
FOREIGNKEYS
}).
then
(
function
(
fks
)
{
expect
(
fks
).
to
.
have
.
length
(
3
);
var
keys
=
Object
.
keys
(
fks
[
0
]),
...
...
@@ -714,6 +714,18 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
}
else
{
console
.
log
(
'This test doesn\'t support '
+
dialect
);
}
return
fks
;
}).
then
(
function
(
fks
){
if
(
dialect
===
'mysql'
)
{
return
self
.
sequelize
.
query
(
self
.
queryInterface
.
QueryGenerator
.
getForeignKeyQuery
(
'hosts'
,
'admin'
),
{}
)
.
spread
(
function
(
fk
){
expect
(
fks
[
0
]).
to
.
deep
.
eql
(
fk
[
0
]);
});
}
return
;
});
});
});
...
...
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