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 8b9e8e52
authored
Aug 04, 2015
by
smihica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for bugfix/pg-delete-failed.
1 parent
cbd13ea7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
test/unit/sql/delete.test.js
test/unit/sql/delete.test.js
0 → 100644
View file @
8b9e8e5
'use strict'
;
/* jshint -W110 */
var
Support
=
require
(
__dirname
+
'/../support'
)
,
util
=
require
(
'util'
)
,
expectsql
=
Support
.
expectsql
,
current
=
Support
.
sequelize
,
Sequelize
=
Support
.
Sequelize
,
sql
=
current
.
dialect
.
QueryGenerator
;
// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation
suite
(
Support
.
getTestDialectTeaser
(
'SQL'
),
function
()
{
suite
(
'delete'
,
function
()
{
suite
(
'delete when the primary key has a different field name'
,
function
()
{
var
User
=
current
.
define
(
'test_user'
,
{
id
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
,
field
:
"test_user_id"
,
}
},
{
freezeTableName
:
true
,
timestamps
:
false
});
var
options
=
{
table
:
'test_user'
,
where
:
{
'test_user_id'
:
100
}
};
test
(
util
.
inspect
(
options
,
{
depth
:
2
}),
function
()
{
return
expectsql
(
sql
.
deleteQuery
(
options
.
table
,
options
.
where
,
options
,
User
),
{
postgres
:
'DELETE FROM "test_user" WHERE "test_user_id" IN (SELECT "test_user_id" FROM "test_user" WHERE "test_user_id" = 100 LIMIT 1)'
,
sqlite
:
'DELETE FROM `test_user` WHERE `test_user_id` = 100'
,
mssql
:
'DELETE TOP(1) FROM [test_user] WHERE [test_user_id] = 100; SELECT @@ROWCOUNT AS AFFECTEDROWS;'
,
default
:
'DELETE FROM [test_user] WHERE [test_user_id] = 100 LIMIT 1'
}
);
});
});
});
});
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