aboutsummaryrefslogtreecommitdiff
path: root/zig-comments/src/migrations
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2023-08-04 22:29:41 +0100
committerMartin Ashby <martin@ashbysoft.com>2023-08-22 10:10:02 +0100
commitff092976a9fdeeba96a0de13d013b9d838640c40 (patch)
treeec3b75a19f649059be8fbec118c79eac67788371 /zig-comments/src/migrations
parente342ead779022fd1e2c4e2d6c1c1e8ecaade80de (diff)
downloadmfashby.net-ff092976a9fdeeba96a0de13d013b9d838640c40.tar.gz
mfashby.net-ff092976a9fdeeba96a0de13d013b9d838640c40.tar.bz2
mfashby.net-ff092976a9fdeeba96a0de13d013b9d838640c40.tar.xz
mfashby.net-ff092976a9fdeeba96a0de13d013b9d838640c40.zip
Convert comments to zig
Diffstat (limited to 'zig-comments/src/migrations')
-rw-r--r--zig-comments/src/migrations/0_init.sql2
-rw-r--r--zig-comments/src/migrations/1_capcha.sql6
2 files changed, 8 insertions, 0 deletions
diff --git a/zig-comments/src/migrations/0_init.sql b/zig-comments/src/migrations/0_init.sql
new file mode 100644
index 0000000..a799784
--- /dev/null
+++ b/zig-comments/src/migrations/0_init.sql
@@ -0,0 +1,2 @@
+create table if not exists comments (url text not null, author text not null, comment text not null, ts timestamptz not null default now());
+create index if not exists idx_comments_url on comments(url); \ No newline at end of file
diff --git a/zig-comments/src/migrations/1_capcha.sql b/zig-comments/src/migrations/1_capcha.sql
new file mode 100644
index 0000000..c80a4bd
--- /dev/null
+++ b/zig-comments/src/migrations/1_capcha.sql
@@ -0,0 +1,6 @@
+create table if not exists capchas(question text not null, answer text not null, id uuid not null default gen_random_uuid());
+create unique index if not exists idx_capchas_id on capchas(id);
+insert into capchas(question, answer) values ('What is 1 + 3?', '4');
+insert into capchas(question, answer) values ('If I have 3 apples and 4 pears, how many fruit do I have?', '7');
+insert into capchas(question, answer) values ('What is 3 squared?', '9');
+insert into capchas(question, answer) values ('What is the meaning of life, the universe, and everything?', '42');