Skip to content

Instantly share code, notes, and snippets.

@tbjers
Last active December 30, 2015 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbjers/d18be8bcc5ec270dc0d9 to your computer and use it in GitHub Desktop.
Save tbjers/d18be8bcc5ec270dc0d9 to your computer and use it in GitHub Desktop.
var UpdateUsersTokens = function () {
this.up = function (next) {
this.changeColumn('users', 'idToken', 'text', function (err, data) {
if (err) {
throw err;
}
else {
this.changeColumn('users', 'accessToken', 'text', function (err, data) {
if (err) {
throw err;
}
else {
next();
}
});
}
});
};
this.down = function (next) {
this.changeColumn('users', 'idToken', 'string', function (err, data) {
if (err) {
throw err;
}
else {
this.changeColumn('users', 'accessToken', 'string', function (err, data) {
if (err) {
throw err;
}
else {
next();
}
});
}
});
};
};
exports.UpdateUsersTokens = UpdateUsersTokens;
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE TEXT' at line 1
at Query.Sequence._packetToError (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/sequences/Sequence.js:32:14)
at Query.ErrorPacket (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/sequences/Query.js:82:18)
at Protocol._parsePacket (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/Protocol.js:177:24)
at Parser.write (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/Parser.js:62:12)
at Protocol.write (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/Protocol.js:37:16)
at Socket.ondata (stream.js:51:26)
at Socket.EventEmitter.emit (events.js:117:20)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
--------------------
at Query.Sequence (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/sequences/Sequence.js:15:20)
at new Query (/Users/torgny/git/cltr/node_modules/mysql/lib/protocol/sequences/Query.js:12:12)
at Function.Connection.createQuery (/Users/torgny/git/cltr/node_modules/mysql/lib/Connection.js:47:10)
at Connection.query (/Users/torgny/git/cltr/node_modules/mysql/lib/Connection.js:131:26)
at utils.mixin.exec (/Users/torgny/.nvm/v0.10.17/lib/node_modules/geddy/node_modules/model/lib/adapters/sql/mysql.js:88:24)
at Migration.changeColumn (/Users/torgny/.nvm/v0.10.17/lib/node_modules/geddy/node_modules/model/lib/migration/migration.js:76:18)
at up (/Users/torgny/git/cltr/db/migrations/20131205162504_update_users_tokens.js:3:10)
at runMigration (/Users/torgny/.nvm/v0.10.17/lib/node_modules/geddy/gen/jakelib/migration.jake:96:24)
at doIt (/Users/torgny/.nvm/v0.10.17/lib/node_modules/geddy/gen/jakelib/migration.jake:61:19)
at runMigrations (/Users/torgny/.nvm/v0.10.17/lib/node_modules/geddy/gen/jakelib/migration.jake:71:9)
var User = function () {
this.defineProperties({
familyName: {type: 'string', required: true},
givenName: {type: 'string', required: true},
email: {type: 'string', required: true},
agentName: {type: 'string'},
verificationCode: {type: 'string'},
verified: {type: 'string'},
admin: {type: 'boolean', default: false},
location: {type: 'int'},
idToken: {type: 'text'},
accessToken: {type: 'text'}
});
this.hasMany('Passports');
this.hasMany('Communities');
};
User = geddy.model.register('User', User);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment