Permalink
Browse files

Update mysql to 2.0

  • Loading branch information...
1 parent 8cd1ec2 commit 46e65b7e63d73e0d83ffefa152ab193793c3e524 @1602 committed Sep 26, 2012
Showing with 6 additions and 5 deletions.
  1. +1 −1 lib/adapters/mysql.js
  2. +1 −1 package.json
  3. +4 −3 test/migration_test.coffee
View
@@ -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
@@ -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",
@@ -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()

0 comments on commit 46e65b7

Please sign in to comment.