ios - How to upgrade database version in sqlite and add new column in table in swift -


i've created sqlite tables app, want add new column in table database. alter table me in problem first want check database version. using pragma user_version check user version , update user_version returning user_version 0.

var database: fmdatabase? = nil      class func getinstance() -> modelmanager{         if(sharedinstance.database == nil){             sharedinstance.database = fmdatabase(path: util.getpath("xxxx.sqlite"))         }         return sharedinstance     }       func userversion(){         sharedinstance.database!.open()         var userver = int()         let resultset = sharedinstance.database?.executequery("pragma user_version", withargumentsinarray: nil)         userver =  int(resultset!.intforcolumn("user_version"))         print("user version : ",userver)         sharedinstance.database!.close()     }      func updateuserversion(){         sharedinstance.database!.open()         sharedinstance.database?.executeupdate("pragma user_version=1", withargumentsinarray: nil)         sharedinstance.database!.close()     } 

follow these steps access database mozila-firefox:

1] download mozila browser 2] in tools select sqlite-manager option. 3]in browse project sqlite database file 4] , whatever changes want on table created. 

hope work you.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -