about summary refs log tree commit diff
path: root/migrations/2018-04-08-133240_create_posts
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-08T13·48+0200
committerVincent Ambo <tazjin@gmail.com>2018-04-08T13·48+0200
commit042eb88fd74033b9b606189b626f3f0a11a3e2b1 (patch)
tree7e7643441c58cd6b77f674d2e2a3b5aac86ddb9e /migrations/2018-04-08-133240_create_posts
parent106ade6e41ff0abe269fca99e332d404b2c549c7 (diff)
feat(migrations): Add posts & threads tables
Diffstat (limited to 'migrations/2018-04-08-133240_create_posts')
-rw-r--r--migrations/2018-04-08-133240_create_posts/down.sql2
-rw-r--r--migrations/2018-04-08-133240_create_posts/up.sql13
2 files changed, 15 insertions, 0 deletions
diff --git a/migrations/2018-04-08-133240_create_posts/down.sql b/migrations/2018-04-08-133240_create_posts/down.sql
new file mode 100644
index 000000000000..8ebcef8e131a
--- /dev/null
+++ b/migrations/2018-04-08-133240_create_posts/down.sql
@@ -0,0 +1,2 @@
+DROP TABLE posts;
+DROP TABLE threads;
diff --git a/migrations/2018-04-08-133240_create_posts/up.sql b/migrations/2018-04-08-133240_create_posts/up.sql
new file mode 100644
index 000000000000..7cf601fa2c54
--- /dev/null
+++ b/migrations/2018-04-08-133240_create_posts/up.sql
@@ -0,0 +1,13 @@
+CREATE TABLE threads (
+  id SERIAL PRIMARY KEY,
+  title VARCHAR NOT NULL,
+  body TEXT NOT NULL,
+  posted TIMESTAMPTZ NOT NULL
+);
+
+CREATE TABLE posts (
+  id SERIAL PRIMARY KEY,
+  thread SERIAL REFERENCES threads (id),
+  body TEXT NOT NULL,
+  posted TIMESTAMPTZ NOT NULL
+);