aboutsummaryrefslogtreecommitdiff
path: root/comments/src/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'comments/src/migrations')
-rw-r--r--comments/src/migrations/0_init.sql2
-rw-r--r--comments/src/migrations/1_capcha.sql6
2 files changed, 8 insertions, 0 deletions
diff --git a/comments/src/migrations/0_init.sql b/comments/src/migrations/0_init.sql
new file mode 100644
index 0000000..a799784
--- /dev/null
+++ b/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/comments/src/migrations/1_capcha.sql b/comments/src/migrations/1_capcha.sql
new file mode 100644
index 0000000..bf43331
--- /dev/null
+++ b/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, id) values ('What is 1 + 3?', '4', 'de850c99-906b-4ff8-b8e7-fce3bccd89bc') on conflict do nothing;
+insert into capchas(question, answer, id) values ('If I have 3 apples and 4 pears, how many fruit do I have?', '7', 'c83e23a8-ec53-48d4-a468-a530dfa634b7') on conflict do nothing;
+insert into capchas(question, answer, id) values ('What is 3 squared?', '9', '798bf299-4e3b-4f98-acac-f0c41201b613') on conflict do nothing;
+insert into capchas(question, answer, id) values ('What is the meaning of life, the universe, and everything?', '42', '7025fcbf-ebe8-4679-809f-08d632591b03') on conflict do nothing;