The alter statement of SQLite is pretty limited. This page shows you:
You can:
and that's it as you can see in this railroad diagram
You can't modify
As you can't modify the structure via an alter statement, you need to:
The detailed procedure as stated in the documentation 1) is:
For changes that do not affect the on-disk content such as:
the Sqlite documentation points to a simplified procedure.
Check the last paragraph of the alter section 7 documentation if you are interested
An example where a name was taken as identifier and that a ID will take over.
PRAGMA foreign_keys=OFF
BEGIN TRANSACTION;
create table THINGS_TMP
(
ID INTEGER PRIMARY KEY,
NAME TEXT UNIQUE,
DESCRIPTION TEXT
);
insert into THINGS_TMP (NAME, DESCRIPTION) from THINGS;
drop table THINGS;
alter table THINGS_TMP rename to THINGS;
PRAGMA foreign_key_check ;
Commit;
PRAGMA foreign_keys=ON