aboutsummaryrefslogtreecommitdiff
path: root/db/user
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-06-28 23:59:50 +0200
committerlonkaars <loek@pipeframe.xyz>2023-06-28 23:59:50 +0200
commit67dbb6421976254658c5e38045513129dd18187a (patch)
tree288b599d1097b26bdbcad3b6749b38e133017cf2 /db/user
initial public commit
Diffstat (limited to 'db/user')
-rw-r--r--db/user/.gitignore2
-rw-r--r--db/user/init.sql16
-rw-r--r--db/user/reset.sql4
-rw-r--r--db/user/root.sql6
4 files changed, 28 insertions, 0 deletions
diff --git a/db/user/.gitignore b/db/user/.gitignore
new file mode 100644
index 0000000..7b59807
--- /dev/null
+++ b/db/user/.gitignore
@@ -0,0 +1,2 @@
+base.sql
+full.sql
diff --git a/db/user/init.sql b/db/user/init.sql
new file mode 100644
index 0000000..1d0e830
--- /dev/null
+++ b/db/user/init.sql
@@ -0,0 +1,16 @@
+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
+);
+
diff --git a/db/user/reset.sql b/db/user/reset.sql
new file mode 100644
index 0000000..d136af3
--- /dev/null
+++ b/db/user/reset.sql
@@ -0,0 +1,4 @@
+drop table if exists sort_overlay;
+
+drop table if exists user;
+
diff --git a/db/user/root.sql b/db/user/root.sql
new file mode 100644
index 0000000..70671ce
--- /dev/null
+++ b/db/user/root.sql
@@ -0,0 +1,6 @@
+-- default user_id = 0 = root (apply to everyone)
+insert into sort_overlay (expression, reading, sort) values
+ ('達','だち',-1),
+ ('の下に','のもとに',-1),
+ ('下に','しもに',-1);
+