create table if not exists user (
	id integer primary key autoincrement,
	username text not null,
	unique(username)
);

insert into user (id, username) values (0, 'root');

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
);

create index sort_overlay_expression on sort_overlay (expression);
create index sort_overlay_reading on sort_overlay (reading);

