about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-08T18·27+0200
committerVincent Ambo <tazjin@gmail.com>2018-04-08T18·27+0200
commitda33786939979350b58a09145b56913963380c92 (patch)
tree1d7013ca991795b11a24b14ab9fa56446a2baad6
parentef5f7af89c8dfadca3d2515e4fa1ce71a4b778b9 (diff)
feat(migrations): Add author columns to tables
Adds columns for author names and emails to both threads and posts.

"Users" don't (yet? who knows!) exist as independent entity in
Converse, they are simply "inferred" via OIDC providers.
-rw-r--r--migrations/2018-04-08-182319_add_authors/down.sql5
-rw-r--r--migrations/2018-04-08-182319_add_authors/up.sql10
2 files changed, 15 insertions, 0 deletions
diff --git a/migrations/2018-04-08-182319_add_authors/down.sql b/migrations/2018-04-08-182319_add_authors/down.sql
new file mode 100644
index 000000000000..8ad817908065
--- /dev/null
+++ b/migrations/2018-04-08-182319_add_authors/down.sql
@@ -0,0 +1,5 @@
+ALTER TABLE threads DROP COLUMN author_name;
+ALTER TABLE threads DROP COLUMN author_email;
+
+ALTER TABLE posts DROP COLUMN author_name;
+ALTER TABLE posts DROP COLUMN author_email;
diff --git a/migrations/2018-04-08-182319_add_authors/up.sql b/migrations/2018-04-08-182319_add_authors/up.sql
new file mode 100644
index 000000000000..ad5beb9f6785
--- /dev/null
+++ b/migrations/2018-04-08-182319_add_authors/up.sql
@@ -0,0 +1,10 @@
+-- This migration adds an 'author' column to the thread & post table.
+-- Authors don't currently exist as independent objects in the
+-- database as most user management is simply delegated to the OIDC
+-- provider.
+
+ALTER TABLE threads ADD COLUMN author_name VARCHAR NOT NULL DEFAULT 'anonymous';
+ALTER TABLE threads ADD COLUMN author_email VARCHAR NOT NULL DEFAULT 'unknown@example.org';
+
+ALTER TABLE posts ADD COLUMN author_name VARCHAR NOT NULL DEFAULT 'anonymous';
+ALTER TABLE posts ADD COLUMN author_email VARCHAR NOT NULL DEFAULT 'unknown@example.org';