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 0b9ddfa4
authored
Sep 13, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for 2233 for pg and sqlite
1 parent
95af31e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
lib/dialects/postgres/query.js
lib/dialects/sqlite/query.js
lib/errors.js
lib/dialects/postgres/query.js
View file @
0b9ddfa
...
...
@@ -226,6 +226,14 @@ module.exports = (function() {
var
match
;
switch
(
err
.
code
)
{
case
'23503'
:
match
=
err
.
message
.
match
(
/violates foreign key constraint
\"(
.+
?)\"
on table
\"(
.+
?)\"
/
);
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
fields
:
null
,
index
:
match
[
1
],
table
:
match
[
2
],
parent
:
err
});
case
'23505'
:
match
=
err
.
detail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
already exists/
);
...
...
lib/dialects/sqlite/query.js
View file @
0b9ddfa
...
...
@@ -197,6 +197,13 @@ module.exports = (function() {
});
}
match
=
err
.
message
.
match
(
/FOREIGN KEY constraint failed/
);
if
(
match
!==
null
)
{
return
new
sequelizeErrors
.
ForeignKeyConstraintError
({
parent
:
err
});
}
return
err
;
case
'SQLITE_BUSY'
:
return
new
sequelizeErrors
.
TimeoutError
(
err
);
...
...
lib/errors.js
View file @
0b9ddfa
...
...
@@ -137,6 +137,7 @@ error.ForeignKeyConstraintError = function (options) {
this
.
message
=
options
.
message
;
this
.
fields
=
options
.
fields
;
this
.
table
=
options
.
table
;
this
.
value
=
options
.
value
;
this
.
index
=
options
.
index
;
};
...
...
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