andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.75k stars 521 forks source link

How to add new column to existing table? #520

Closed gurjnderSingh closed 2 years ago

gurjnderSingh commented 2 years ago

I want to add new column in my db. My app is live. when i add new column it throw error error: {"message":"no such column: todoStar","code":5} Please guide how to do this?

huyhai commented 2 years ago

if (error.message.indexOf('no such column: todoStar') > -1) { db.transaction(this.updateColumn) } updateColumn = (tx) => { tx.executeSql('ALTER TABLE todo ADD todoStar varchar(55);') } this work for me but not work for column UNIQUE

gurjnderSingh commented 2 years ago

Thanks! @huyhai