不要怂,就是干,撸起袖子干!

Commit 36693078 by Mick Hansen

test(query-generator): fix mysql query generator addIndex tests to check for escaped tables

1 parent 4fe4b37b
......@@ -264,7 +264,7 @@ module.exports = (function() {
},
showIndexQuery: function(tableName, options) {
var sql = 'SHOW INDEX FROM <%= tableName %> <%= options %>';
var sql = 'SHOW INDEX FROM <%= tableName %><%= options %>';
return Utils._.template(sql)({
tableName: this.quoteIdentifiers(tableName),
options: (options || {}).database ? ' FROM `' + options.database + '`' : ''
......
......@@ -474,7 +474,7 @@ if (Support.dialectIsMySQL()) {
addIndexQuery: [
{
arguments: ['User', ['username', 'isAdmin']],
expectation: 'CREATE INDEX user_username_is_admin ON User (`username`, `isAdmin`)'
expectation: 'CREATE INDEX user_username_is_admin ON `User` (`username`, `isAdmin`)'
}, {
arguments: [
'User', [
......@@ -482,17 +482,17 @@ if (Support.dialectIsMySQL()) {
'isAdmin'
]
],
expectation: "CREATE INDEX user_username_is_admin ON User (`username`(10) ASC, `isAdmin`)"
expectation: "CREATE INDEX user_username_is_admin ON `User` (`username`(10) ASC, `isAdmin`)"
}, {
arguments: [
'User', ['username', 'isAdmin'], { parser: 'foo', indicesType: 'FULLTEXT', indexName: 'bar'}
],
expectation: "CREATE FULLTEXT INDEX bar ON User (`username`, `isAdmin`) WITH PARSER foo"
expectation: "CREATE FULLTEXT INDEX bar ON `User` (`username`, `isAdmin`) WITH PARSER foo"
}, {
arguments: [
'User', ['username', 'isAdmin'], { indicesType: 'UNIQUE'}
],
expectation: "CREATE UNIQUE INDEX user_username_is_admin ON User (`username`, `isAdmin`)"
expectation: "CREATE UNIQUE INDEX user_username_is_admin ON `User` (`username`, `isAdmin`)"
}
],
......@@ -509,10 +509,10 @@ if (Support.dialectIsMySQL()) {
removeIndexQuery: [
{
arguments: ['User', 'user_foo_bar'],
expectation: "DROP INDEX user_foo_bar ON User"
expectation: "DROP INDEX user_foo_bar ON `User`"
}, {
arguments: ['User', ['foo', 'bar']],
expectation: "DROP INDEX user_foo_bar ON User"
expectation: "DROP INDEX user_foo_bar ON `User`"
}
],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!