Update mysql to 2.0

This commit is contained in:
Anatoliy Chakkaev 2012-09-26 08:08:27 +04:00
parent 8cd1ec2e9e
commit 46e65b7e63
3 changed files with 6 additions and 5 deletions

View File

@ -10,7 +10,7 @@ exports.initialize = function initializeSchema(schema, callback) {
if (!mysql) return;
var s = schema.settings;
schema.client = mysql.createClient({
schema.client = mysql.createConnection({
host: s.host || 'localhost',
port: s.port || 3306,
user: s.username,

View File

@ -35,7 +35,7 @@
"redis": "= 0.7.2",
"hiredis": "latest",
"mongoose": "latest",
"mysql": ">= 0.9.4",
"mysql": ">= 2.0.0-alpha3",
"pg": "= 0.7.2",
"sqlite3": ">= 2.0.18",
"riak-js": ">= 0.4.1",

View File

@ -45,10 +45,12 @@ getFields = (model, cb) ->
getIndexes = (model, cb) ->
query 'SHOW INDEXES FROM ' + model, (err, res) ->
if err
console.log err
cb err
else
indexes = {}
res.forEach (index) -> indexes[index.Key_name] = index if index.Seq_in_index == 1
res.forEach (index) ->
indexes[index.Key_name] = index if index.Seq_in_index == '1'
cb err, indexes
it 'should run migration', (test) ->
@ -162,7 +164,7 @@ it 'should add single-column index', (test) ->
getIndexes 'User', (err, ixs) ->
test.ok ixs.email && ixs.email.Column_name == 'email'
console.log(ixs)
test.equal ixs.email.Index_type, 'BTREE' # default
test.equal ixs.email.Index_type, 'BTREE', 'default index type'
test.done()
it 'should change type of single-column index', (test) ->
@ -172,7 +174,6 @@ it 'should change type of single-column index', (test) ->
User.schema.autoupdate (err) ->
return console.log(err) if err
getIndexes 'User', (err, ixs) ->
console.log ixs.email
test.ok ixs.email && ixs.email.Column_name == 'email'
test.equal ixs.email.Index_type, 'BTREE'
test.done()