alter table files add if not exists state varchar(256) default 'approved';
update files f set state = 'approved' where f.state = '' or f.state IS NULL;

create index files_pending_idx on files(state) where state = 'sent_for_checking' or state = 'on_checking';
