0
votes

i write a app with appcelerator titanium and want to add an attribute in a model class. I must write a migration to prevent android errors with "..has no column.."

(http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Sync_Adapters_and_Migrations-section-36739597_AlloySyncAdaptersandMigrations-Migrations)

I just want to drop the table "favorites":

migration.up = function(migrator) {
    migrator.dropTable("favorites");
};

Why it doesn't work and the error message is still where?

migrator.createTable(...) also didn't work

1

1 Answers

0
votes

create a migration file: alloy generate migration favorites

add the following code: migration.up = function(migrator) {

migrator.dropTable("favorites");

migrator.createTable({
    columns: {
        "id": 'INTEGER PRIMARY KEY AUTOINCREMENT',

        "title":"text",
        "url":"text",
        "some_new_column":"text"

     }
 });

};

migration.down = function(migrator) { migrator.dropTable("favorites");

};