1 alter table transactions add keep boolean default 1 not null;
2 update transactions set keep = 1;
3 create table transactions_new(id integer, date varchar, description varchar, data_hash varchar, keep boolean);
4 insert into transactions_new(id, date, description, data_hash, keep) select cast(id as integer), date, description, data_hash, keep from transactions;
5 drop table transactions;
6 create table transactions(id integer primary key, date varchar, description varchar, data_hash varchar, keep boolean);
7 create unique index un_transactions_data_hash on transactions(data_hash);
8 insert into transactions(id, date, description, data_hash, keep) select id, date, description, data_hash, keep from transactions_new;
9 drop table transactions_new;