【问题标题】:add an attribute in a model class after deploy a appcelerator titanium app部署 appcelerator Titan 应用程序后在模型类中添加属性
【发布时间】:2016-09-10 05:37:23
【问题描述】:

我用 appcelerator Titan 编写了一个应用程序,并想在模型类中添加一个属性。我必须编写迁移以防止出现“..没有列..”的 android 错误

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

我只想删除“收藏夹”表:

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

为什么不起作用,错误信息还在哪里?

migrator.createTable(...) 也没有用

【问题讨论】:

    标签: model attributes titanium appcelerator


    【解决方案1】:

    创建迁移文件: 合金产生迁移的最爱

    添加以下代码: 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("收藏夹");

    };

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-12-06
      • 1970-01-01
      • 2017-08-09
      • 1970-01-01
      • 2017-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多