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

Commit 0027dfae by sdepold

index basics are working

1 parent 41bcd2f8
......@@ -185,18 +185,19 @@ var QueryGenerator = module.exports = {
},
addIndexQuery: function(tableName, attributes, options) {
// var sql = [
// "CREATE <%= indicesType %> INDEX <%= name %>",
// "<%= indexType %> ON <%= tableName %> <%= columns %>",
// "<%= parser %>"
// ].join(' ')
// return Utils._.template(sql)({
// indicesType: options.indicesType || '',
// name: options.indexName,
// indexType: options.indexType ? 'USING ' + options.indexType : undefined,
// })
options = Utils._.extend({
indicesType: null,
indexName: Utils._.underscored(tableName + '_' + attributes.join('_')),
parser: null
}, options || {})
return Utils._.compact([
"CREATE", options.indicesType || null, "INDEX", options.indexName,
options.indexType ? 'USING ' + options.indexType : undefined,
"ON", tableName, attributes.join(', '),
options.parser ? "WITH PARSER " + options.parser : undefined
]).join(' ')
/*
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
......
......@@ -124,12 +124,12 @@ describe('QueryGenerator', function() {
}
],
//'addIndexQuery': [
// {
// arguments: ['User', ['username', 'isAdmin']],
// expectation: 'CREATE INDEX user_username_is_admin ON User username, isAdmin'
// }
//],
'addIndexQuery': [
{
arguments: ['User', ['username', 'isAdmin']],
expectation: 'CREATE INDEX user_username_is_admin ON User username, isAdmin'
}
],
'hashToWhereConditions': [
{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!