Im developing a small app that stores information in a database.
When I first released, I tried to make sure my DB was future-proofed against any changes.
However i'm about to release a new version that requires a change to the DB schema.
Currently my terrible way of handling this is my DB Manager class will try to create the table in the constructor, if the Create commands come back with an exception (table already exists) catch it and move on.
This has been working fine, now I need to make a change to the schema without losing all my users data. For now i'm putting more SQL statements in the DB Manager to save data, drop table, create table and put it back in. Which will work, but is not good I assume, and will only work for this version, any new changes will need something different.
How does everyone else handle this? Adding tables/columns if not present removing columns etc without losing data and seamlessly to the user?
Any tips will be appreciated.