summaryrefslogtreecommitdiff
path: root/migrations
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-08-30 00:36:46 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-08-30 00:36:46 +0700
commit78fe4481099fcf6666f1a259e38d9d828a253347 (patch)
treec4f8bc344da8a26536fb85d5fb3fec891bdf7eb6 /migrations
parent753fe7f1d5bf837a85481425bd6bf6b431ffb611 (diff)
downloadweb-78fe4481099fcf6666f1a259e38d9d828a253347.tar.gz
web-78fe4481099fcf6666f1a259e38d9d828a253347.zip
feat: add persistent storage for likes
Diffstat (limited to 'migrations')
-rw-r--r--migrations/1_create_stats_tables.down.sql2
-rw-r--r--migrations/1_create_stats_tables.up.sql11
2 files changed, 13 insertions, 0 deletions
diff --git a/migrations/1_create_stats_tables.down.sql b/migrations/1_create_stats_tables.down.sql
new file mode 100644
index 0000000..ee4593c
--- /dev/null
+++ b/migrations/1_create_stats_tables.down.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS blog_views;
+DROP TABLE IF EXISTS blog_likes;
diff --git a/migrations/1_create_stats_tables.up.sql b/migrations/1_create_stats_tables.up.sql
new file mode 100644
index 0000000..8852268
--- /dev/null
+++ b/migrations/1_create_stats_tables.up.sql
@@ -0,0 +1,11 @@
+CREATE TABLE IF NOT EXISTS blog_likes (
+ page_ref VARCHAR(32) NOT NULL,
+ user_id VARCHAR(32) NOT NULL,
+ PRIMARY KEY (page_ref, user_id)
+) WITHOUT ROWID;
+
+CREATE TABLE IF NOT EXISTS blog_views (
+ page_ref VARCHAR(32) NOT NULL,
+ user_id VARCHAR(32) NOT NULL,
+ PRIMARY KEY (page_ref, user_id)
+) WITHOUT ROWID;