From 8422e49e78501e3d8563f7bcf31497466c598443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Tue, 10 Mar 2026 16:51:43 +0100 Subject: [PATCH] add PGlite user_votes table for local vote caching --- src/client/shared/db/migrations/002_user_votes.sql | 6 ++++++ src/client/shared/db/migrations/index.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/client/shared/db/migrations/002_user_votes.sql diff --git a/src/client/shared/db/migrations/002_user_votes.sql b/src/client/shared/db/migrations/002_user_votes.sql new file mode 100644 index 0000000..8cb6d54 --- /dev/null +++ b/src/client/shared/db/migrations/002_user_votes.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS user_votes ( + legislation_id INTEGER NOT NULL, + vote TEXT NOT NULL CHECK (vote IN ('ja', 'nein', 'enthaltung')), + voted_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY (legislation_id) +); diff --git a/src/client/shared/db/migrations/index.ts b/src/client/shared/db/migrations/index.ts index 85c434c..dfa15cf 100644 --- a/src/client/shared/db/migrations/index.ts +++ b/src/client/shared/db/migrations/index.ts @@ -1,3 +1,4 @@ import init from "./001_init.sql?raw" +import userVotes from "./002_user_votes.sql?raw" -export const migrations: string[] = [init] +export const migrations: string[] = [init, userVotes]