How can I change the type of an existing property in Geddy?
I believe I need to change the type as set when defining the properties in the model file:
this.defineProperties({
title: {type: 'string', required: true},
description: {type: 'text'},
status: {type: 'boolean'}
});
I also think I need to alter the table in a migration. I'm using the 'changeColumn' function as documented here http://geddyjs.org/guide#models
var StatusToBoolean = function () {
this.up = function (next) {
this.changeColumn("step", 'status', 'boolean', function (err, data) {
if (err) { throw err; }
next();
});
};
this.down = function (next) {
this.changeColumn('step', 'status', 'string', function (err, data) {
if (err) { throw err; }
next();
});
};
};
exports.StatusToBoolean = StatusToBoolean;
However, when I run this migration I get a 'SQLITE_ERROR: near "ALTER"' error:
Hindenburg:to_do Tom$ geddy jake db:migrate --trace
Running migrations for development environment...
Running status_to_boolean (up)
jake aborted.
Error: SQLITE_ERROR: near "ALTER": syntax error
Hindenburg:to_do Tom$
This makes me think I'm doing something wrong. I tried the '--trace' option (as you can see), but that didn't give any helpful information.
I also suspect that I need to actually change some of the data in the table (so that it can map to the new datatype), but the documentation is unclear on how to do that.
Any help is appreciated. Thanks.