Say we had created simple db table like:
CREATE TABLE IF NOT EXISTS users (email varchar(100) UNIQUE NOT NULL primary key, pass varchar(100))
now we want to CREATE TABLE IF NOT EXISTS or merge with previous one that would look like
users (email varchar(100) UNIQUE NOT NULL primary key, name varchar(100))
so if table existed we want to remove pass column and add name column.
Is such thing possible via SQL commands and SQLite pragmas or how to do it using C SQLite api?
As it turns out, in SQLite you’d have to recreate the entire table if you want to drop a single column. The example at the link provided is pretty good – you may want to tweak it to suit your needs, though.
Here’s what I came up with.