aboutsummaryrefslogtreecommitdiff
path: root/db/user/init.sql
blob: af60fa3cdd8637dc465fbf8c4eb34e21bc912cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);