renameColumn: TypeError ... in MySQL driver
Created by: mcandre
I'm trying to rename a column, perhaps I'm doing something wrong.
Trace
$ db-migrate up
[ERROR] TypeError: Cannot read property 'COLUMN_TYPE' of undefined
at c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\db-migrate\lib\driver\mysql.js:128:33
at Query.<anonymous> (c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\mysql\lib\client.js:108:11)
at Query.EventEmitter.emit (events.js:92:17)
at Query._handlePacket (c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\mysql\lib\query.js:51:14)
at Client._handlePacket (c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\mysql\lib\client.js:329:14)
at Parser.EventEmitter.emit (events.js:95:17)
at emitPacket (c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\mysql\lib\parser.js:71:14)
at Parser.write (c:\Documents and Settings\apenneba\Desktop\src\nicplus\node_modules\mysql\lib\parser.js:576:7)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:710:14)
Migration
var dbm = require('db-migrate');
var type = dbm.dataType;
exports.up = function(db, callback) {
db.renameTable('githubrepos', 'github_repos', function (err) {
if (err) {
callback();
}
else {
db.renameColumn('github_repos', 'githubrepo_id', 'github_repo_id', callback);
}
});
};
exports.down = function(db, callback) {
db.renameTable('github_repos', 'githubrepos', function(err) {
if (err) {
callback();
}
else {
db.renameColumn('githubrepos', 'github_repo_id', 'githubrepo_id', callback);
}
});
};
System
$ specs db-migrate node mysql os
Specs:
specs 0.4
https://github.com/mcandre/specs#readme
db-migrate --version
0.4.1
npm --version
1.2.17
node --version
v0.10.3
mysql --version
mysql Ver 14.14 Distrib 5.6.10, for Win32 (x86)
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 3 Build 2600