Update mysql to 2.0
This commit is contained in:
parent
8cd1ec2e9e
commit
46e65b7e63
|
@ -10,7 +10,7 @@ exports.initialize = function initializeSchema(schema, callback) {
|
||||||
if (!mysql) return;
|
if (!mysql) return;
|
||||||
|
|
||||||
var s = schema.settings;
|
var s = schema.settings;
|
||||||
schema.client = mysql.createClient({
|
schema.client = mysql.createConnection({
|
||||||
host: s.host || 'localhost',
|
host: s.host || 'localhost',
|
||||||
port: s.port || 3306,
|
port: s.port || 3306,
|
||||||
user: s.username,
|
user: s.username,
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"redis": "= 0.7.2",
|
"redis": "= 0.7.2",
|
||||||
"hiredis": "latest",
|
"hiredis": "latest",
|
||||||
"mongoose": "latest",
|
"mongoose": "latest",
|
||||||
"mysql": ">= 0.9.4",
|
"mysql": ">= 2.0.0-alpha3",
|
||||||
"pg": "= 0.7.2",
|
"pg": "= 0.7.2",
|
||||||
"sqlite3": ">= 2.0.18",
|
"sqlite3": ">= 2.0.18",
|
||||||
"riak-js": ">= 0.4.1",
|
"riak-js": ">= 0.4.1",
|
||||||
|
|
|
@ -45,10 +45,12 @@ getFields = (model, cb) ->
|
||||||
getIndexes = (model, cb) ->
|
getIndexes = (model, cb) ->
|
||||||
query 'SHOW INDEXES FROM ' + model, (err, res) ->
|
query 'SHOW INDEXES FROM ' + model, (err, res) ->
|
||||||
if err
|
if err
|
||||||
|
console.log err
|
||||||
cb err
|
cb err
|
||||||
else
|
else
|
||||||
indexes = {}
|
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
|
cb err, indexes
|
||||||
|
|
||||||
it 'should run migration', (test) ->
|
it 'should run migration', (test) ->
|
||||||
|
@ -162,7 +164,7 @@ it 'should add single-column index', (test) ->
|
||||||
getIndexes 'User', (err, ixs) ->
|
getIndexes 'User', (err, ixs) ->
|
||||||
test.ok ixs.email && ixs.email.Column_name == 'email'
|
test.ok ixs.email && ixs.email.Column_name == 'email'
|
||||||
console.log(ixs)
|
console.log(ixs)
|
||||||
test.equal ixs.email.Index_type, 'BTREE' # default
|
test.equal ixs.email.Index_type, 'BTREE', 'default index type'
|
||||||
test.done()
|
test.done()
|
||||||
|
|
||||||
it 'should change type of single-column index', (test) ->
|
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) ->
|
User.schema.autoupdate (err) ->
|
||||||
return console.log(err) if err
|
return console.log(err) if err
|
||||||
getIndexes 'User', (err, ixs) ->
|
getIndexes 'User', (err, ixs) ->
|
||||||
console.log ixs.email
|
|
||||||
test.ok ixs.email && ixs.email.Column_name == 'email'
|
test.ok ixs.email && ixs.email.Column_name == 'email'
|
||||||
test.equal ixs.email.Index_type, 'BTREE'
|
test.equal ixs.email.Index_type, 'BTREE'
|
||||||
test.done()
|
test.done()
|
||||||
|
|
Loading…
Reference in New Issue