create table if not exists user ( id integer primary key autoincrement, username text not null, unique(username) ); create table if not exists sort_overlay ( id integer primary key autoincrement, user_id int not null default 0, expression text not null, reading text not null, sort int not null, foreign key(user_id) references user(id), unique(user_id, expression, reading) on conflict replace );