about summary refs log tree commit diff stats
path: root/sql/pgsql
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-02-18 12:34:17 +0300
committerAndrew Dolgov <fox@fakecake.org>2024-02-18 12:34:56 +0300
commiteb52a7da8e2cafa1892d3f8810a69435b7a9b854 (patch)
tree286a54c4ea0d153fb31ce69edb0b8233e8046934 /sql/pgsql
parent19b3e7fff80d430a9f287138f9cf84a1faa681fd (diff)
downloadthe-epube-eb52a7da8e2cafa1892d3f8810a69435b7a9b854.tar.gz
the-epube-eb52a7da8e2cafa1892d3f8810a69435b7a9b854.tar.xz
add pgsql support
Diffstat (limited to 'sql/pgsql')
-rw-r--r--sql/pgsql/migrations/1.sql1
-rw-r--r--sql/pgsql/schema.sql23
2 files changed, 24 insertions, 0 deletions
diff --git a/sql/pgsql/migrations/1.sql b/sql/pgsql/migrations/1.sql
new file mode 100644
index 0000000..e0298b7
--- /dev/null
+++ b/sql/pgsql/migrations/1.sql
@@ -0,0 +1 @@
+select true;
diff --git a/sql/pgsql/schema.sql b/sql/pgsql/schema.sql
new file mode 100644
index 0000000..3616f06
--- /dev/null
+++ b/sql/pgsql/schema.sql
@@ -0,0 +1,23 @@
+create table if not exists epube_users (
+	id serial not null primary key,
+	username varchar(100) not null unique,
+	pass varchar(200) not null);
+
+create table if not exists epube_pagination (
+	id serial not null primary key,
+	bookid bigint not null,
+	total_pages bigint not null,
+	pagination text not null);
+
+create table if not exists epube_books (
+	id serial not null primary key,
+	bookid bigint not null,
+	owner varchar(200) not null not null references epube_users(username) on delete cascade,
+	lastts bigint not null,
+	lastcfi text not null,
+	lastread bigint not null);
+
+create table if not exists epube_favorites(
+	id serial not null primary key,
+	bookid bigint not null,
+	owner varchar(200) not null references epube_users(username) on delete cascade);