搜索得知,原来SQLite目前还不支持drop column,所以必须想出另外一种方法来进行表字段的删除。

如下sql语句会复制一个和record表一样表结构的temp表出来,但是我们想要的是去除某一个字段(例如去除record表中的name字段,就不要复制它就好了),所以sql语句如下:

create table temp as select id, name, type, trigger, state, next_run_time, description, failed_times, scheduler from task where 1 = 1;

这样复制出来的表就会缺少“custom_fields”字段,然后我们删除旧表并修改新表名即可。

drop table task;  
alter table temp rename to task;