ujjwalguptaofficial / JsStore

Simplifying IndexedDB with SQL like syntax and promises
http://jsstore.net/
MIT License
858 stars 110 forks source link

Table refresh with new columns #65

Closed pawangujral closed 6 years ago

pawangujral commented 6 years ago

Hi,

Is there a way to refresh table with new columns? say I've name, age as column for now & after adding few data, I would like to add new column email & just refresh table design and it add default null value on all rows.

Hope I explained it correctly. Thanks for the help.

ujjwalguptaofficial commented 6 years ago

Yeah I got you. You can achieve the above scenario but due to the limitation of indexeddb - all data from a particular table will be deleted. To overcome this situation - you can select all data and assign to a variable and when table schema is recreated, you can reinsert those data.

check out change table schema doc - http://jsstore.net/tutorial/change-table-design/

I have also created an example for demonstrating this - https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/change%20table%20schema

pawangujral commented 6 years ago

Thanks Ujjwal. I've faced anything issue as well. I've raised it, please look into it as well.

Cheers!