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.73k stars 240 forks source link

How to add new field ? #195

Open FeiCheung opened 7 years ago

FeiCheung commented 7 years ago

my code: f (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();

my app's being in production I want to add a new field ‘sex’ to the 'user'schema.

var User = persistence.define('User', { name: "TEXT", age: "INTEGER", sex:"TEXT" });

I dont want uninstall my app , how could I add this field ?? thanks for help

0scar14 commented 7 years ago

you can check https://github.com/coresmart/persistencejs/blob/master/docs/migrations.md