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 00f08106
authored
Mar 09, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed schema errors for mysql and sqlite
1 parent
444ab99b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
187 deletions
lib/dao-factory.js
lib/dialects/abstract/query-generator.js
lib/dialects/mysql/query-generator.js
lib/dialects/postgres/query-generator.js
lib/query-interface.js
lib/sequelize.js
test/associations/has-many.test.js
test/associations/multiple-level-filters.test.js
test/postgres/query-generator.test.js
lib/dao-factory.js
View file @
00f0810
...
@@ -602,7 +602,7 @@ module.exports = (function() {
...
@@ -602,7 +602,7 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
col
=
this
.
sequelize
.
col
(
'*'
)
var
col
=
this
.
sequelize
.
col
(
'*'
)
if
(
options
.
include
)
{
if
(
options
.
include
)
{
col
=
this
.
sequelize
.
col
(
this
.
tableName
+
'.'
+
(
this
.
primaryKeyAttributes
[
0
]
||
'id'
))
col
=
this
.
sequelize
.
col
(
this
.
getTableName
()
+
'.'
+
(
this
.
primaryKeyAttributes
[
0
]
||
'id'
))
}
}
options
.
attributes
=
[
options
.
attributes
=
[
...
@@ -928,7 +928,7 @@ module.exports = (function() {
...
@@ -928,7 +928,7 @@ module.exports = (function() {
records
.
push
(
values
)
records
.
push
(
values
)
})
})
self
.
QueryInterface
.
bulkInsert
(
self
.
tableName
,
records
,
options
,
self
)
self
.
QueryInterface
.
bulkInsert
(
self
.
getTableName
()
,
records
,
options
,
self
)
.
on
(
'sql'
,
function
(
sql
)
{
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'sql'
,
sql
)
})
})
...
@@ -1019,10 +1019,10 @@ module.exports = (function() {
...
@@ -1019,10 +1019,10 @@ module.exports = (function() {
var
attrValueHash
=
{}
var
attrValueHash
=
{}
attrValueHash
[
self
.
_timestampAttributes
.
deletedAt
]
=
Utils
.
now
()
attrValueHash
[
self
.
_timestampAttributes
.
deletedAt
]
=
Utils
.
now
()
query
=
'bulkUpdate'
query
=
'bulkUpdate'
args
=
[
self
.
tableName
,
attrValueHash
,
where
]
args
=
[
self
.
getTableName
()
,
attrValueHash
,
where
]
}
else
{
}
else
{
query
=
'bulkDelete'
query
=
'bulkDelete'
args
=
[
self
.
tableName
,
where
,
options
]
args
=
[
self
.
getTableName
()
,
where
,
options
]
}
}
var
runQuery
=
function
(
err
,
records
)
{
var
runQuery
=
function
(
err
,
records
)
{
...
@@ -1145,7 +1145,7 @@ module.exports = (function() {
...
@@ -1145,7 +1145,7 @@ module.exports = (function() {
return
emitter
.
emit
(
'error'
,
err
)
return
emitter
.
emit
(
'error'
,
err
)
}
}
query
=
self
.
QueryInterface
.
bulkUpdate
(
self
.
tableName
,
attrValueHash
,
where
,
options
)
query
=
self
.
QueryInterface
.
bulkUpdate
(
self
.
getTableName
()
,
attrValueHash
,
where
,
options
)
query
.
on
(
'sql'
,
function
(
sql
)
{
query
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'sql'
,
sql
)
})
})
...
...
lib/dialects/abstract/query-generator.js
View file @
00f0810
...
@@ -371,7 +371,7 @@ module.exports = (function() {
...
@@ -371,7 +371,7 @@ module.exports = (function() {
return
table
return
table
}
}
return
this
.
quoteIdentifier
s
(
param
)
return
this
.
quoteIdentifier
(
param
)
},
},
/*
/*
...
@@ -508,14 +508,7 @@ module.exports = (function() {
...
@@ -508,14 +508,7 @@ module.exports = (function() {
quoteIdentifiers
:
function
(
identifiers
,
force
)
{
quoteIdentifiers
:
function
(
identifiers
,
force
)
{
if
(
identifiers
.
indexOf
(
'.'
)
!==
-
1
)
{
if
(
identifiers
.
indexOf
(
'.'
)
!==
-
1
)
{
identifiers
=
identifiers
.
split
(
'.'
)
identifiers
=
identifiers
.
split
(
'.'
)
return
this
.
quoteIdentifier
(
identifiers
.
slice
(
0
,
identifiers
.
length
-
1
).
join
(
'.'
))
+
'.'
+
this
.
quoteIdentifier
(
identifiers
[
identifiers
.
length
-
1
])
if
(
this
.
_dialect
.
supports
.
schemas
)
{
// quote every part
return
identifiers
.
map
(
function
(
t
)
{
return
this
.
quoteIdentifier
(
t
,
force
)
}.
bind
(
this
)).
join
(
'.'
)
}
else
{
// only quote the last part seperately
return
this
.
quoteIdentifier
(
identifiers
.
slice
(
0
,
identifiers
.
length
-
1
).
join
(
'.'
))
+
'.'
+
this
.
quoteIdentifier
(
identifiers
[
identifiers
.
length
-
1
])
}
}
else
{
}
else
{
return
this
.
quoteIdentifier
(
identifiers
)
return
this
.
quoteIdentifier
(
identifiers
)
}
}
...
...
lib/dialects/mysql/query-generator.js
View file @
00f0810
...
@@ -57,7 +57,7 @@ module.exports = (function() {
...
@@ -57,7 +57,7 @@ module.exports = (function() {
}
}
var
values
=
{
var
values
=
{
table
:
this
.
quote
Identifier
(
tableName
),
table
:
this
.
quote
Table
(
tableName
),
attributes
:
attrStr
.
join
(
", "
),
attributes
:
attrStr
.
join
(
", "
),
comment
:
options
.
comment
&&
Utils
.
_
.
isString
(
options
.
comment
)
?
" COMMENT "
+
this
.
escape
(
options
.
comment
)
:
""
,
comment
:
options
.
comment
&&
Utils
.
_
.
isString
(
options
.
comment
)
?
" COMMENT "
+
this
.
escape
(
options
.
comment
)
:
""
,
engine
:
options
.
engine
,
engine
:
options
.
engine
,
...
@@ -177,7 +177,7 @@ module.exports = (function() {
...
@@ -177,7 +177,7 @@ module.exports = (function() {
var
replacements
=
{
var
replacements
=
{
ignoreDuplicates
:
options
&&
options
.
ignoreDuplicates
?
' IGNORE'
:
''
,
ignoreDuplicates
:
options
&&
options
.
ignoreDuplicates
?
' IGNORE'
:
''
,
table
:
this
.
quote
Identifier
(
tableName
),
table
:
this
.
quote
Table
(
tableName
),
attributes
:
allAttributes
.
map
(
function
(
attr
){
attributes
:
allAttributes
.
map
(
function
(
attr
){
return
this
.
quoteIdentifier
(
attr
)
return
this
.
quoteIdentifier
(
attr
)
}.
bind
(
this
)).
join
(
","
),
}.
bind
(
this
)).
join
(
","
),
...
@@ -190,7 +190,7 @@ module.exports = (function() {
...
@@ -190,7 +190,7 @@ module.exports = (function() {
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
options
=
options
||
{}
options
=
options
||
{}
var
table
=
this
.
quote
Identifier
(
tableName
)
var
table
=
this
.
quote
Table
(
tableName
)
if
(
options
.
truncate
===
true
)
{
if
(
options
.
truncate
===
true
)
{
// Truncate does not allow LIMIT and WHERE
// Truncate does not allow LIMIT and WHERE
return
"TRUNCATE "
+
table
return
"TRUNCATE "
+
table
...
@@ -213,7 +213,7 @@ module.exports = (function() {
...
@@ -213,7 +213,7 @@ module.exports = (function() {
bulkDeleteQuery
:
function
(
tableName
,
where
,
options
)
{
bulkDeleteQuery
:
function
(
tableName
,
where
,
options
)
{
options
=
options
||
{}
options
=
options
||
{}
var
table
=
this
.
quote
Identifier
(
tableName
)
var
table
=
this
.
quote
Table
(
tableName
)
where
=
this
.
getWhereConditions
(
where
)
where
=
this
.
getWhereConditions
(
where
)
var
query
=
"DELETE FROM "
+
table
+
" WHERE "
+
where
var
query
=
"DELETE FROM "
+
table
+
" WHERE "
+
where
...
@@ -326,7 +326,7 @@ module.exports = (function() {
...
@@ -326,7 +326,7 @@ module.exports = (function() {
}
}
if
(
dataType
.
references
)
{
if
(
dataType
.
references
)
{
template
+=
" REFERENCES "
+
this
.
quote
Identifier
(
dataType
.
references
)
template
+=
" REFERENCES "
+
this
.
quote
Table
(
dataType
.
references
)
if
(
dataType
.
referencesKey
)
{
if
(
dataType
.
referencesKey
)
{
template
+=
" ("
+
this
.
quoteIdentifier
(
dataType
.
referencesKey
)
+
")"
template
+=
" ("
+
this
.
quoteIdentifier
(
dataType
.
referencesKey
)
+
")"
...
@@ -410,7 +410,7 @@ module.exports = (function() {
...
@@ -410,7 +410,7 @@ module.exports = (function() {
* @return {String} The generated sql query.
* @return {String} The generated sql query.
*/
*/
dropForeignKeyQuery
:
function
(
tableName
,
foreignKey
)
{
dropForeignKeyQuery
:
function
(
tableName
,
foreignKey
)
{
return
'ALTER TABLE '
+
this
.
quote
Identifier
(
tableName
)
+
' DROP FOREIGN KEY '
+
this
.
quoteIdentifier
(
foreignKey
)
+
';'
return
'ALTER TABLE '
+
this
.
quote
Table
(
tableName
)
+
' DROP FOREIGN KEY '
+
this
.
quoteIdentifier
(
foreignKey
)
+
';'
},
},
mysqlDataTypeMapping
:
function
(
tableName
,
attr
,
dataType
)
{
mysqlDataTypeMapping
:
function
(
tableName
,
attr
,
dataType
)
{
...
...
lib/dialects/postgres/query-generator.js
View file @
00f0810
...
@@ -132,14 +132,15 @@ module.exports = (function() {
...
@@ -132,14 +132,15 @@ module.exports = (function() {
}
}
return
Utils
.
_
.
template
(
query
)({
return
Utils
.
_
.
template
(
query
)({
tableName
:
this
.
quoteIdentifiers
(
tableName
),
tableName
:
this
.
quoteTable
(
tableName
),
attributes
:
attrString
.
join
(
', '
)
})
attributes
:
attrString
.
join
(
', '
)
})
},
},
arrayValue
:
function
(
value
,
key
,
_key
,
factory
,
logicResult
){
arrayValue
:
function
(
value
,
key
,
_key
,
factory
,
logicResult
){
var
col
=
null
var
col
=
null
,
coltype
=
null
,
coltype
=
null
,
_realKey
=
key
.
split
(
'.'
).
pop
()
,
_realKey
=
key
.
split
(
'.'
).
pop
()
.
replace
(
/"/g
,
''
)
,
_value
,
_value
if
(
value
.
length
===
0
)
{
value
=
[
null
]
}
if
(
value
.
length
===
0
)
{
value
=
[
null
]
}
...
@@ -152,6 +153,7 @@ module.exports = (function() {
...
@@ -152,6 +153,7 @@ module.exports = (function() {
coltype
=
coltype
.
toString
();
coltype
=
coltype
.
toString
();
}
}
}
}
if
(
col
&&
((
!!
coltype
&&
coltype
.
match
(
/
\[\]
$/
)
!==
null
)
||
(
col
.
toString
().
match
(
/
\[\]
$/
)
!==
null
)))
{
if
(
col
&&
((
!!
coltype
&&
coltype
.
match
(
/
\[\]
$/
)
!==
null
)
||
(
col
.
toString
().
match
(
/
\[\]
$/
)
!==
null
)))
{
_value
=
'ARRAY['
+
value
.
map
(
this
.
escape
.
bind
(
this
)).
join
(
','
)
+
']::'
+
(
!!
col
.
type
?
col
.
type
:
col
.
toString
())
_value
=
'ARRAY['
+
value
.
map
(
this
.
escape
.
bind
(
this
)).
join
(
','
)
+
']::'
+
(
!!
col
.
type
?
col
.
type
:
col
.
toString
())
return
[
_key
,
_value
].
join
(
" && "
)
return
[
_key
,
_value
].
join
(
" && "
)
...
@@ -813,27 +815,9 @@ module.exports = (function() {
...
@@ -813,27 +815,9 @@ module.exports = (function() {
* @return {String} The generated sql query.
* @return {String} The generated sql query.
*/
*/
dropForeignKeyQuery
:
function
(
tableName
,
foreignKey
)
{
dropForeignKeyQuery
:
function
(
tableName
,
foreignKey
)
{
return
'ALTER TABLE '
+
this
.
quote
Identifier
(
tableName
)
+
' DROP CONSTRAINT '
+
this
.
quoteIdentifier
(
foreignKey
)
+
';'
return
'ALTER TABLE '
+
this
.
quote
Table
(
tableName
)
+
' DROP CONSTRAINT '
+
this
.
quoteIdentifier
(
foreignKey
)
+
';'
}
}
}
}
// Private
var
removeSerialsFromHash
=
function
(
tableName
,
attrValueHash
)
{
var
returning
=
[];
Utils
.
_
.
forEach
(
attrValueHash
,
function
(
value
,
key
,
hash
)
{
if
(
tables
[
tableName
]
&&
tables
[
tableName
][
key
])
{
switch
(
tables
[
tableName
][
key
])
{
case
'bigserial'
:
case
'serial'
:
delete
hash
[
key
]
returning
.
push
(
key
)
break
}
}
});
return
returning
;
}
return
Utils
.
_
.
extend
(
Utils
.
_
.
clone
(
require
(
"../abstract/query-generator"
)),
QueryGenerator
)
return
Utils
.
_
.
extend
(
Utils
.
_
.
clone
(
require
(
"../abstract/query-generator"
)),
QueryGenerator
)
})()
})()
lib/query-interface.js
View file @
00f0810
...
@@ -28,7 +28,7 @@ module.exports = (function() {
...
@@ -28,7 +28,7 @@ module.exports = (function() {
var
self
=
this
var
self
=
this
if
(
!
this
.
QueryGenerator
.
_dialect
.
supports
.
schemas
)
{
if
(
!
this
.
QueryGenerator
.
_dialect
.
supports
.
schemas
)
{
return
this
.
dropAllTables
()
return
this
.
sequelize
.
drop
()
}
else
{
}
else
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
self
.
showAllSchemas
().
success
(
function
(
schemaNames
)
{
self
.
showAllSchemas
().
success
(
function
(
schemaNames
)
{
...
@@ -143,36 +143,16 @@ module.exports = (function() {
...
@@ -143,36 +143,16 @@ module.exports = (function() {
chainer2
.
run
().
success
(
function
()
{
chainer2
.
run
().
success
(
function
()
{
queryAndEmit
queryAndEmit
.
call
(
self
,
sql
,
'createTable'
,
options
)
.
call
(
self
,
sql
,
'createTable'
,
options
)
.
success
(
function
(
res
)
{
.
proxy
(
emitter
,
{
events
:
[
'success'
,
'error'
,
'sql'
]})
self
.
emit
(
'createTable'
,
null
)
emitter
.
emit
(
'success'
,
res
)
})
.
error
(
function
(
err
)
{
self
.
emit
(
'createTable'
,
err
)
emitter
.
emit
(
'error'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'error'
,
err
)
}).
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
})
.
proxy
(
emitter
,
{
events
:
[
'error'
,
'sql'
]})
})
})
}
else
{
}
else
{
attributes
=
self
.
QueryGenerator
.
attributesToSQL
(
attributeHashes
)
attributes
=
self
.
QueryGenerator
.
attributesToSQL
(
attributeHashes
)
sql
=
self
.
QueryGenerator
.
createTableQuery
(
tableName
,
attributes
,
options
)
sql
=
self
.
QueryGenerator
.
createTableQuery
(
tableName
,
attributes
,
options
)
queryAndEmit
.
call
(
self
,
sql
,
'createTable'
,
options
).
success
(
function
(
results
)
{
queryAndEmit
.
call
(
self
,
sql
,
'createTable'
,
options
)
self
.
emit
(
'createTable'
,
null
)
.
proxy
(
emitter
,
{
events
:
[
'success'
,
'error'
,
'sql'
]})
emitter
.
emit
(
'success'
,
results
)
}).
error
(
function
(
err
)
{
self
.
emit
(
'createTable'
,
err
)
emitter
.
emit
(
'error'
,
err
)
}).
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}
}
}).
run
()
}).
run
()
}
}
...
@@ -215,15 +195,12 @@ module.exports = (function() {
...
@@ -215,15 +195,12 @@ module.exports = (function() {
}
}
}
}
chainer
.
runSerially
().
success
(
function
(
results
)
{
chainer
.
runSerially
()
emitter
.
emit
(
'success'
,
results
[
0
])
.
success
(
function
(
results
)
{
self
.
emit
(
'dropTable'
,
null
)
emitter
.
emit
(
'success'
,
results
[
0
])
}).
error
(
function
(
err
)
{
self
.
emit
(
'dropTable'
,
null
)
emitter
.
emit
(
'error'
,
err
)
})
self
.
emit
(
'dropTable'
,
err
)
.
proxy
(
emitter
,
{
events
:
[
'error'
,
'sql'
]})
}).
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}).
run
()
}).
run
()
}
}
...
@@ -247,7 +224,6 @@ module.exports = (function() {
...
@@ -247,7 +224,6 @@ module.exports = (function() {
self
.
emit
(
'dropAllTables'
,
err
)
self
.
emit
(
'dropAllTables'
,
err
)
dropAllTablesEmitter
.
emit
(
'error'
,
err
)
dropAllTablesEmitter
.
emit
(
'error'
,
err
)
}
}
self
.
showAllTables
().
success
(
function
(
tableNames
)
{
self
.
showAllTables
().
success
(
function
(
tableNames
)
{
self
.
getForeignKeysForTables
(
tableNames
).
success
(
function
(
foreignKeys
)
{
self
.
getForeignKeysForTables
(
tableNames
).
success
(
function
(
foreignKeys
)
{
...
@@ -269,11 +245,7 @@ module.exports = (function() {
...
@@ -269,11 +245,7 @@ module.exports = (function() {
chainer
chainer
.
runSerially
()
.
runSerially
()
.
success
(
function
()
{
.
proxy
(
dropAllTablesEmitter
,
{
proxy
:
[
'success'
,
'error'
,
'sql'
]})
self
.
emit
(
'dropAllTables'
,
null
)
dropAllTablesEmitter
.
emit
(
'success'
,
null
)
})
.
error
(
onError
)
}).
error
(
onError
)
}).
error
(
onError
)
}).
error
(
onError
)
}).
error
(
onError
)
}).
run
()
}).
run
()
...
@@ -317,7 +289,6 @@ module.exports = (function() {
...
@@ -317,7 +289,6 @@ module.exports = (function() {
QueryInterface
.
prototype
.
showAllTables
=
function
(
options
)
{
QueryInterface
.
prototype
.
showAllTables
=
function
(
options
)
{
var
self
=
this
var
self
=
this
options
=
Utils
.
_
.
extend
({
options
=
Utils
.
_
.
extend
({
transaction
:
null
,
transaction
:
null
,
raw
:
true
raw
:
true
...
@@ -327,18 +298,13 @@ module.exports = (function() {
...
@@ -327,18 +298,13 @@ module.exports = (function() {
var
showTablesSql
=
self
.
QueryGenerator
.
showTablesQuery
()
var
showTablesSql
=
self
.
QueryGenerator
.
showTablesQuery
()
self
.
sequelize
.
query
(
showTablesSql
,
null
,
options
).
success
(
function
(
tableNames
)
{
self
.
sequelize
.
query
(
showTablesSql
,
null
,
options
).
success
(
function
(
tableNames
)
{
self
.
emit
(
'showAllTables'
,
null
)
emitter
.
emit
(
'success'
,
Utils
.
_
.
flatten
(
tableNames
))
emitter
.
emit
(
'success'
,
Utils
.
_
.
flatten
(
tableNames
))
}).
error
(
function
(
err
)
{
}).
proxy
(
emitter
,
{
events
:
[
'error'
,
'sql'
]})
self
.
emit
(
'showAllTables'
,
err
)
emitter
.
emit
(
'error'
,
err
)
})
}).
run
()
}).
run
()
}
}
QueryInterface
.
prototype
.
describeTable
=
function
(
tableName
,
options
)
{
QueryInterface
.
prototype
.
describeTable
=
function
(
tableName
,
options
)
{
var
self
=
this
var
schema
=
null
,
schema
=
null
,
schemaDelimiter
=
null
,
schemaDelimiter
=
null
if
(
typeof
options
===
"string"
)
{
if
(
typeof
options
===
"string"
)
{
...
@@ -349,34 +315,27 @@ module.exports = (function() {
...
@@ -349,34 +315,27 @@ module.exports = (function() {
schemaDelimiter
=
options
.
schemaDelimiter
||
null
schemaDelimiter
=
options
.
schemaDelimiter
||
null
}
}
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
sql
;
var
sql
;
if
(
self
.
QueryGenerator
.
describeTableQuery
)
{
if
(
this
.
QueryGenerator
.
describeTableQuery
)
{
sql
=
self
.
QueryGenerator
.
describeTableQuery
(
tableName
,
schema
,
schemaDelimiter
)
sql
=
this
.
QueryGenerator
.
describeTableQuery
(
tableName
,
schema
,
schemaDelimiter
)
}
else
{
}
else
{
var
table
=
self
.
QueryGenerator
.
quoteIdentifier
(
// TODO move this to abstract query gen.
self
.
QueryGenerator
.
addSchema
({
var
table
=
this
.
QueryGenerator
.
quoteTable
(
tableName
:
tableName
,
this
.
QueryGenerator
.
addSchema
({
options
:
{
tableName
:
tableName
,
schema
:
schema
,
options
:
{
schemaDelimiter
:
schema
:
schema
,
schemaDelimiter
schemaDelimiter
:
}
schemaDelimiter
}),
}
self
.
QueryGenerator
.
options
.
quoteIdentifiers
}),
)
this
.
QueryGenerator
.
options
.
quoteIdentifiers
sql
=
'DESCRIBE '
+
table
+
';'
)
}
sql
=
'DESCRIBE '
+
table
+
';'
}
self
.
sequelize
.
query
(
sql
,
null
,
{
raw
:
true
}).
success
(
function
(
data
)
{
return
this
.
sequelize
.
query
(
sql
,
null
,
{
raw
:
true
})
emitter
.
emit
(
'success'
,
data
)
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'error'
,
err
)
}).
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}).
run
()
}
}
QueryInterface
.
prototype
.
addColumn
=
function
(
tableName
,
attributeName
,
dataTypeOrOptions
)
{
QueryInterface
.
prototype
.
addColumn
=
function
(
tableName
,
attributeName
,
dataTypeOrOptions
)
{
...
@@ -537,26 +496,9 @@ module.exports = (function() {
...
@@ -537,26 +496,9 @@ module.exports = (function() {
}
}
QueryInterface
.
prototype
.
bulkUpdate
=
function
(
tableName
,
values
,
identifier
,
options
)
{
QueryInterface
.
prototype
.
bulkUpdate
=
function
(
tableName
,
values
,
identifier
,
options
)
{
var
self
=
this
var
sql
=
this
.
QueryGenerator
.
updateQuery
(
tableName
,
values
,
identifier
,
options
)
,
sql
=
self
.
QueryGenerator
.
updateQuery
(
tableName
,
values
,
identifier
,
options
)
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
this
.
queryAndEmit
([
sql
,
null
,
options
],
'bulkUpdate'
)
var
chainer
=
new
Utils
.
QueryChainer
()
chainer
.
add
(
self
,
'queryAndEmit'
,
[[
sql
,
null
,
options
],
'bulkUpdate'
])
return
chainer
.
runSerially
()
.
success
(
function
(
results
){
emitter
.
query
=
{
sql
:
sql
}
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'success'
,
results
[
0
])
})
.
error
(
function
(
err
)
{
emitter
.
query
=
{
sql
:
sql
}
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'error'
,
err
)
})
}).
run
()
}
}
QueryInterface
.
prototype
.
delete
=
function
(
dao
,
tableName
,
identifier
,
options
)
{
QueryInterface
.
prototype
.
delete
=
function
(
dao
,
tableName
,
identifier
,
options
)
{
...
@@ -652,26 +594,9 @@ module.exports = (function() {
...
@@ -652,26 +594,9 @@ module.exports = (function() {
}
}
QueryInterface
.
prototype
.
bulkDelete
=
function
(
tableName
,
identifier
,
options
)
{
QueryInterface
.
prototype
.
bulkDelete
=
function
(
tableName
,
identifier
,
options
)
{
var
self
=
this
var
sql
=
this
.
QueryGenerator
.
deleteQuery
(
tableName
,
identifier
,
Utils
.
_
.
defaults
(
options
||
{},
{
limit
:
null
}))
var
sql
=
self
.
QueryGenerator
.
deleteQuery
(
tableName
,
identifier
,
Utils
.
_
.
defaults
(
options
||
{},
{
limit
:
null
}))
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
chainer
=
new
Utils
.
QueryChainer
()
chainer
.
add
(
self
,
'queryAndEmit'
,
[[
sql
,
null
,
options
],
'bulkDelete'
,
options
])
chainer
.
runSerially
()
return
this
.
queryAndEmit
([
sql
,
null
,
options
],
'bulkDelete'
,
options
)
.
success
(
function
(
results
){
emitter
.
query
=
{
sql
:
sql
}
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'success'
,
results
[
0
])
})
.
error
(
function
(
err
)
{
emitter
.
query
=
{
sql
:
sql
}
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'error'
,
err
)
})
}).
run
()
}
}
QueryInterface
.
prototype
.
select
=
function
(
factory
,
tableName
,
options
,
queryOptions
)
{
QueryInterface
.
prototype
.
select
=
function
(
factory
,
tableName
,
options
,
queryOptions
)
{
...
@@ -744,13 +669,7 @@ module.exports = (function() {
...
@@ -744,13 +669,7 @@ module.exports = (function() {
self
.
emit
(
'rawSelect'
,
null
)
self
.
emit
(
'rawSelect'
,
null
)
emitter
.
emit
(
'success'
,
result
)
emitter
.
emit
(
'success'
,
result
)
})
})
.
error
(
function
(
err
)
{
.
proxy
(
emitter
,
{
events
:
[
'error'
,
'sql'
]})
self
.
emit
(
'rawSelect'
,
err
)
emitter
.
emit
(
'error'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}).
run
()
}).
run
()
}
}
...
...
lib/sequelize.js
View file @
00f0810
...
@@ -384,7 +384,7 @@ module.exports = (function() {
...
@@ -384,7 +384,7 @@ module.exports = (function() {
// creation order
// creation order
if
(
options
.
force
)
{
if
(
options
.
force
)
{
chainer
.
add
(
this
,
'drop'
)
chainer
.
add
(
this
,
'drop'
,
[
options
]
)
}
}
this
.
daoFactoryManager
.
forEachDAO
(
function
(
dao
)
{
this
.
daoFactoryManager
.
forEachDAO
(
function
(
dao
)
{
...
@@ -398,7 +398,7 @@ module.exports = (function() {
...
@@ -398,7 +398,7 @@ module.exports = (function() {
return
chainer
.
runSerially
()
return
chainer
.
runSerially
()
}
}
Sequelize
.
prototype
.
drop
=
function
()
{
Sequelize
.
prototype
.
drop
=
function
(
options
)
{
var
self
=
this
var
self
=
this
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
...
@@ -406,7 +406,7 @@ module.exports = (function() {
...
@@ -406,7 +406,7 @@ module.exports = (function() {
self
.
daoFactoryManager
.
forEachDAO
(
function
(
dao
)
{
self
.
daoFactoryManager
.
forEachDAO
(
function
(
dao
)
{
if
(
dao
)
{
if
(
dao
)
{
chainer
.
add
(
dao
,
'drop'
,
[])
chainer
.
add
(
dao
,
'drop'
,
[
options
])
}
}
},
{
reverse
:
false
})
},
{
reverse
:
false
})
...
...
test/associations/has-many.test.js
View file @
00f0810
...
@@ -637,7 +637,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -637,7 +637,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
AcmeUser
.
hasMany
(
AcmeProject
,
{
through
:
AcmeProjectUsers
})
AcmeUser
.
hasMany
(
AcmeProject
,
{
through
:
AcmeProjectUsers
})
AcmeProject
.
hasMany
(
AcmeUser
,
{
through
:
AcmeProjectUsers
})
AcmeProject
.
hasMany
(
AcmeUser
,
{
through
:
AcmeProjectUsers
})
self
.
sequelize
.
dropAllSchemas
().
done
(
function
(
err
)
{
self
.
sequelize
.
dropAllSchemas
().
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
self
.
sequelize
.
createSchema
(
'acme'
).
done
(
function
(
err
)
{
self
.
sequelize
.
createSchema
(
'acme'
).
done
(
function
(
err
)
{
...
...
test/associations/multiple-level-filters.test.js
View file @
00f0810
...
@@ -46,7 +46,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
...
@@ -46,7 +46,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
}]).
success
(
function
()
{
}]).
success
(
function
()
{
Task
.
findAll
({
Task
.
findAll
({
where
:
{
where
:
{
'
project.u
ser.username'
:
'leia'
'
Project.U
ser.username'
:
'leia'
},
},
include
:
[
include
:
[
{
model
:
Project
,
include
:
[
{
model
:
Project
,
include
:
[
...
@@ -111,8 +111,8 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
...
@@ -111,8 +111,8 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
}]).
success
(
function
()
{
}]).
success
(
function
()
{
Task
.
findAll
({
Task
.
findAll
({
where
:
{
where
:
{
'
project.u
ser.username'
:
'leia'
,
'
Project.U
ser.username'
:
'leia'
,
'
project.u
ser.id'
:
1
'
Project.U
ser.id'
:
1
},
},
include
:
[
include
:
[
{
model
:
Project
,
include
:
[
{
model
:
Project
,
include
:
[
...
@@ -174,7 +174,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
...
@@ -174,7 +174,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
}]).
success
(
function
()
{
}]).
success
(
function
()
{
User
.
findAll
({
User
.
findAll
({
where
:
{
where
:
{
'
projects.t
asks.title'
:
'fight empire'
'
Projects.T
asks.title'
:
'fight empire'
},
},
include
:
[
include
:
[
{
model
:
Project
,
include
:
[
{
model
:
Project
,
include
:
[
...
@@ -223,7 +223,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
...
@@ -223,7 +223,7 @@ describe(Support.getTestDialectTeaser("Multiple Level Filters"), function() {
user
.
setProjects
([
project
]).
success
(
function
(){
user
.
setProjects
([
project
]).
success
(
function
(){
User
.
findAll
({
User
.
findAll
({
where
:
{
where
:
{
'
p
rojects.title'
:
'republic'
'
P
rojects.title'
:
'republic'
},
},
include
:
[
include
:
[
{
model
:
Project
}
{
model
:
Project
}
...
...
test/postgres/query-generator.test.js
View file @
00f0810
...
@@ -135,7 +135,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -135,7 +135,7 @@ if (dialect.match(/^postgres/)) {
expectation
:
"CREATE TABLE IF NOT EXISTS \"myTable\" (\"data\" bytea);"
expectation
:
"CREATE TABLE IF NOT EXISTS \"myTable\" (\"data\" bytea);"
},
},
{
{
arguments
:
[
'mySchema.myTable'
,
{
title
:
'VARCHAR(255)'
,
name
:
'VARCHAR(255)'
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
title
:
'VARCHAR(255)'
,
name
:
'VARCHAR(255)'
}],
expectation
:
"CREATE TABLE IF NOT EXISTS \"mySchema\".\"myTable\" (\"title\" VARCHAR(255), \"name\" VARCHAR(255));"
expectation
:
"CREATE TABLE IF NOT EXISTS \"mySchema\".\"myTable\" (\"title\" VARCHAR(255), \"name\" VARCHAR(255));"
},
},
{
{
...
@@ -185,7 +185,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -185,7 +185,7 @@ if (dialect.match(/^postgres/)) {
expectation
:
"DROP TABLE IF EXISTS \"myTable\";"
expectation
:
"DROP TABLE IF EXISTS \"myTable\";"
},
},
{
{
arguments
:
[
'mySchema.myTable'
],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
],
expectation
:
"DROP TABLE IF EXISTS \"mySchema\".\"myTable\";"
expectation
:
"DROP TABLE IF EXISTS \"mySchema\".\"myTable\";"
},
},
{
{
...
@@ -193,7 +193,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -193,7 +193,7 @@ if (dialect.match(/^postgres/)) {
expectation
:
"DROP TABLE IF EXISTS \"myTable\" CASCADE;"
expectation
:
"DROP TABLE IF EXISTS \"myTable\" CASCADE;"
},
},
{
{
arguments
:
[
'mySchema.myTable'
,
{
cascade
:
true
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
cascade
:
true
}],
expectation
:
"DROP TABLE IF EXISTS \"mySchema\".\"myTable\" CASCADE;"
expectation
:
"DROP TABLE IF EXISTS \"mySchema\".\"myTable\" CASCADE;"
},
},
...
@@ -204,7 +204,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -204,7 +204,7 @@ if (dialect.match(/^postgres/)) {
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
},
{
{
arguments
:
[
'mySchema.myTable'
],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
],
expectation
:
"DROP TABLE IF EXISTS mySchema.myTable;"
,
expectation
:
"DROP TABLE IF EXISTS mySchema.myTable;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
},
...
@@ -214,7 +214,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -214,7 +214,7 @@ if (dialect.match(/^postgres/)) {
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
},
{
{
arguments
:
[
'mySchema.myTable'
,
{
cascade
:
true
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
cascade
:
true
}],
expectation
:
"DROP TABLE IF EXISTS mySchema.myTable CASCADE;"
,
expectation
:
"DROP TABLE IF EXISTS mySchema.myTable CASCADE;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
}
}
...
@@ -352,10 +352,10 @@ if (dialect.match(/^postgres/)) {
...
@@ -352,10 +352,10 @@ if (dialect.match(/^postgres/)) {
arguments
:
[
'myTable'
,
{
offset
:
2
}],
arguments
:
[
'myTable'
,
{
offset
:
2
}],
expectation
:
"SELECT * FROM \"myTable\" OFFSET 2;"
expectation
:
"SELECT * FROM \"myTable\" OFFSET 2;"
},
{
},
{
arguments
:
[
'mySchema.myTable'
],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
],
expectation
:
"SELECT * FROM \"mySchema\".\"myTable\";"
expectation
:
"SELECT * FROM \"mySchema\".\"myTable\";"
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
where
:
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
where
:
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}}],
expectation
:
"SELECT * FROM \"mySchema\".\"myTable\" WHERE \"mySchema\".\"myTable\".\"name\"='foo'';DROP TABLE mySchema.myTable;';"
expectation
:
"SELECT * FROM \"mySchema\".\"myTable\" WHERE \"mySchema\".\"myTable\".\"name\"='foo'';DROP TABLE mySchema.myTable;';"
},
{
},
{
title
:
'buffer as where argument'
,
title
:
'buffer as where argument'
,
...
@@ -427,11 +427,11 @@ if (dialect.match(/^postgres/)) {
...
@@ -427,11 +427,11 @@ if (dialect.match(/^postgres/)) {
expectation
:
"SELECT * FROM myTable OFFSET 2;"
,
expectation
:
"SELECT * FROM myTable OFFSET 2;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
],
expectation
:
"SELECT * FROM mySchema.myTable;"
,
expectation
:
"SELECT * FROM mySchema.myTable;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
where
:
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
where
:
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}}],
expectation
:
"SELECT * FROM mySchema.myTable WHERE mySchema.myTable.name='foo'';DROP TABLE mySchema.myTable;';"
,
expectation
:
"SELECT * FROM mySchema.myTable WHERE mySchema.myTable.name='foo'';DROP TABLE mySchema.myTable;';"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
{
},
{
...
@@ -486,13 +486,13 @@ if (dialect.match(/^postgres/)) {
...
@@ -486,13 +486,13 @@ if (dialect.match(/^postgres/)) {
expectation
:
"INSERT INTO \"myTable\" (\"name\") VALUES ('foo') RETURNING *;"
,
expectation
:
"INSERT INTO \"myTable\" (\"name\") VALUES ('foo') RETURNING *;"
,
context
:
{
options
:
{
omitNull
:
true
}}
context
:
{
options
:
{
omitNull
:
true
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
'foo'
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
'foo'
}],
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('foo') RETURNING *;"
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('foo') RETURNING *;"
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
JSON
.
stringify
({
info
:
'Look ma a " quote'
})}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
JSON
.
stringify
({
info
:
'Look ma a " quote'
})}],
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('{\"info\":\"Look ma a \\\" quote\"}') RETURNING *;"
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('{\"info\":\"Look ma a \\\" quote\"}') RETURNING *;"
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}],
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('foo'';DROP TABLE mySchema.myTable;') RETURNING *;"
expectation
:
"INSERT INTO \"mySchema\".\"myTable\" (\"name\") VALUES ('foo'';DROP TABLE mySchema.myTable;') RETURNING *;"
},
{
},
{
arguments
:
[
'myTable'
,
function
(
sequelize
)
{
arguments
:
[
'myTable'
,
function
(
sequelize
)
{
...
@@ -542,15 +542,15 @@ if (dialect.match(/^postgres/)) {
...
@@ -542,15 +542,15 @@ if (dialect.match(/^postgres/)) {
expectation
:
"INSERT INTO myTable (name) VALUES ('foo') RETURNING *;"
,
expectation
:
"INSERT INTO myTable (name) VALUES ('foo') RETURNING *;"
,
context
:
{
options
:
{
omitNull
:
true
,
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
omitNull
:
true
,
quoteIdentifiers
:
false
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
'foo'
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
'foo'
}],
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('foo') RETURNING *;"
,
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('foo') RETURNING *;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
JSON
.
stringify
({
info
:
'Look ma a " quote'
})}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
JSON
.
stringify
({
info
:
'Look ma a " quote'
})}],
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('{\"info\":\"Look ma a \\\" quote\"}') RETURNING *;"
,
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('{\"info\":\"Look ma a \\\" quote\"}') RETURNING *;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
}],
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('foo'';DROP TABLE mySchema.myTable;') RETURNING *;"
,
expectation
:
"INSERT INTO mySchema.myTable (name) VALUES ('foo'';DROP TABLE mySchema.myTable;') RETURNING *;"
,
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
context
:
{
options
:
{
quoteIdentifiers
:
false
}}
}
}
...
@@ -676,10 +676,10 @@ if (dialect.match(/^postgres/)) {
...
@@ -676,10 +676,10 @@ if (dialect.match(/^postgres/)) {
expectation
:
"UPDATE \"myTable\" SET \"bar\"=2 WHERE \"name\"='foo' RETURNING *"
,
expectation
:
"UPDATE \"myTable\" SET \"bar\"=2 WHERE \"name\"='foo' RETURNING *"
,
context
:
{
options
:
{
omitNull
:
true
}}
context
:
{
options
:
{
omitNull
:
true
}}
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
'foo'
,
birthday
:
moment
(
"2011-03-27 10:01:55 +0000"
,
"YYYY-MM-DD HH:mm:ss Z"
).
toDate
()},
{
id
:
2
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
'foo'
,
birthday
:
moment
(
"2011-03-27 10:01:55 +0000"
,
"YYYY-MM-DD HH:mm:ss Z"
).
toDate
()},
{
id
:
2
}],
expectation
:
"UPDATE \"mySchema\".\"myTable\" SET \"name\"='foo',\"birthday\"='2011-03-27 10:01:55.000 +00:00' WHERE \"id\"=2 RETURNING *"
expectation
:
"UPDATE \"mySchema\".\"myTable\" SET \"name\"='foo',\"birthday\"='2011-03-27 10:01:55.000 +00:00' WHERE \"id\"=2 RETURNING *"
},
{
},
{
arguments
:
[
'mySchema.myTable'
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
},
{
name
:
'foo'
}],
arguments
:
[
{
tableName
:
'myTable'
,
schema
:
'mySchema'
}
,
{
name
:
"foo';DROP TABLE mySchema.myTable;"
},
{
name
:
'foo'
}],
expectation
:
"UPDATE \"mySchema\".\"myTable\" SET \"name\"='foo'';DROP TABLE mySchema.myTable;' WHERE \"name\"='foo' RETURNING *"
expectation
:
"UPDATE \"mySchema\".\"myTable\" SET \"name\"='foo'';DROP TABLE mySchema.myTable;' WHERE \"name\"='foo' RETURNING *"
},
{
},
{
arguments
:
[
'myTable'
,
function
(
sequelize
)
{
arguments
:
[
'myTable'
,
function
(
sequelize
)
{
...
...
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