aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql2
-rw-r--r--db/schema_0032-add-from_body-reference.sql6
2 files changed, 7 insertions, 1 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 1608b08ba..8045ca6c4 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -111,7 +111,7 @@ create table users (
name text,
phone text,
password text not null default '',
- from_body integer, -- id of body user is from or null/0 if not
+ from_body integer references body(id), -- id of body user is from or null/0 if not
flagged boolean not null default 'f',
title text
);
diff --git a/db/schema_0032-add-from_body-reference.sql b/db/schema_0032-add-from_body-reference.sql
new file mode 100644
index 000000000..4fa526963
--- /dev/null
+++ b/db/schema_0032-add-from_body-reference.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER TABLE users ADD CONSTRAINT users_from_body_fkey
+ FOREIGN KEY (from_body) REFERENCES body(id);
+
+commit;