coresmart / persistencejs

persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
http://persistencejs.org
1.72k stars 239 forks source link

如何为某表增加一个字段? #194

Open FeiCheung opened 8 years ago

FeiCheung commented 8 years ago

我是做移动开发 比如现在有个表user if (window.openDatabase) { persistence.store.websql.config(persistence, 'testdb', 'My SQLite database', 5 * 1024 * 1024); } else { persistence.store.memory.config(persistence); }

var User = persistence.define('User', { name: "TEXT", age: "INTEGER" }); persistence.schemaSync(); user表有两个字段 name 和 age 我现在想增加一个字段比如 sex var User = persistence.define('User', { name: "TEXT", age: "INTEGER", sex:"TEXT" }); 当我这样写完之后,重新运行程序sex字段却不存在 , 需要我卸载应用重新生成数据库才能建立此字段。 这个问题如何解决呢? 总不能每次表结构变动了 就重新安装程序吧,求大神指导。。

ceeji commented 8 years ago

Why don't you use English?