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 239da95e
authored
Apr 20, 2015
by
Ruben Bridgewater
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix foreign database language failures
1 parent
95a5c0d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
lib/dialects/mysql/query.js
lib/dialects/postgres/query.js
lib/dialects/mysql/query.js
View file @
239da95
...
@@ -112,7 +112,7 @@ module.exports = (function() {
...
@@ -112,7 +112,7 @@ module.exports = (function() {
case
1062
:
case
1062
:
match
=
err
.
message
.
match
(
/Duplicate entry '
(
.*
)
' for key '
?((
.|
\s)
*
?)
'
?
$/
);
match
=
err
.
message
.
match
(
/Duplicate entry '
(
.*
)
' for key '
?((
.|
\s)
*
?)
'
?
$/
);
var
values
=
match
[
1
].
split
(
'-'
)
var
values
=
match
?
match
[
1
].
split
(
'-'
)
:
undefined
,
fields
=
{}
,
fields
=
{}
,
message
=
'Validation error'
,
message
=
'Validation error'
,
uniqueKey
=
this
.
callee
&&
this
.
callee
.
__options
.
uniqueKeys
[
match
[
2
]];
,
uniqueKey
=
this
.
callee
&&
this
.
callee
.
__options
.
uniqueKeys
[
match
[
2
]];
...
@@ -142,7 +142,7 @@ module.exports = (function() {
...
@@ -142,7 +142,7 @@ module.exports = (function() {
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
fields
:
null
,
fields
:
null
,
index
:
match
[
3
]
,
index
:
match
?
match
[
3
]
:
undefined
,
parent
:
err
parent
:
err
});
});
...
@@ -151,7 +151,7 @@ module.exports = (function() {
...
@@ -151,7 +151,7 @@ module.exports = (function() {
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
fields
:
null
,
fields
:
null
,
index
:
match
[
1
]
,
index
:
match
?
match
[
1
]
:
undefined
,
parent
:
err
parent
:
err
});
});
...
...
lib/dialects/postgres/query.js
View file @
239da95
...
@@ -354,8 +354,10 @@ module.exports = (function() {
...
@@ -354,8 +354,10 @@ module.exports = (function() {
switch
(
code
)
{
switch
(
code
)
{
case
'23503'
:
case
'23503'
:
index
=
errMessage
.
match
(
/violates foreign key constraint
\"(
.+
?)\"
/
)[
1
];
index
=
errMessage
.
match
(
/violates foreign key constraint
\"(
.+
?)\"
/
);
table
=
errMessage
.
match
(
/on table
\"(
.+
?)\"
/
)[
1
];
index
=
index
?
index
[
1
]
:
undefined
;
table
=
errMessage
.
match
(
/on table
\"(
.+
?)\"
/
);
table
=
table
?
table
[
1
]
:
undefined
;
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
fields
:
null
,
fields
:
null
,
...
@@ -404,7 +406,9 @@ module.exports = (function() {
...
@@ -404,7 +406,9 @@ module.exports = (function() {
case
'23P01'
:
case
'23P01'
:
match
=
errDetail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
/
);
match
=
errDetail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
/
);
fields
=
Utils
.
_
.
zipObject
(
match
[
1
].
split
(
', '
),
match
[
2
].
split
(
', '
));
if
(
match
)
{
fields
=
Utils
.
_
.
zipObject
(
match
[
1
].
split
(
', '
),
match
[
2
].
split
(
', '
));
}
message
=
'Exclusion constraint error'
;
message
=
'Exclusion constraint error'
;
return
new
sequelizeErrors
.
ExclusionConstraintError
({
return
new
sequelizeErrors
.
ExclusionConstraintError
({
...
...
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