diff options
Diffstat (limited to 'util/sql')
-rw-r--r-- | util/sql/func.sql | 4 | ||||
-rw-r--r-- | util/sql/schema.sql | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/util/sql/func.sql b/util/sql/func.sql index b1edd59b..9675097e 100644 --- a/util/sql/func.sql +++ b/util/sql/func.sql @@ -599,8 +599,8 @@ $$ LANGUAGE plpgsql; -- called on INSERT INTO threads_posts CREATE OR REPLACE FUNCTION notify_pm() RETURNS trigger AS $$ BEGIN - INSERT INTO notifications (ntype, ltype, uid, iid, subid) - SELECT 'pm', 't', tb.iid, t.id, NEW.num + INSERT INTO notifications (ntype, ltype, uid, iid, subid, c_title, c_byuser) + SELECT 'pm', 't', tb.iid, t.id, NEW.num, t.title, NEw.uid FROM threads t JOIN threads_boards tb ON tb.tid = t.id WHERE t.id = NEW.tid diff --git a/util/sql/schema.sql b/util/sql/schema.sql index 557b75a1..c496e01d 100644 --- a/util/sql/schema.sql +++ b/util/sql/schema.sql @@ -34,7 +34,9 @@ CREATE TABLE notifications ( ntype notification_ntype NOT NULL, ltype notification_ltype NOT NULL, iid integer NOT NULL, - subid integer + subid integer, + c_title text NOT NULL, + c_byuser integer ); -- producers @@ -354,6 +356,7 @@ CREATE TABLE wlists ( ALTER TABLE changes ADD FOREIGN KEY (requester) REFERENCES users (id); ALTER TABLE notifications ADD FOREIGN KEY (uid) REFERENCES users (id); +ALTER TABLE notifications ADD FOREIGN KEY (c_byuser) REFERENCES users (id); ALTER TABLE producers ADD FOREIGN KEY (latest) REFERENCES producers_rev (id) DEFERRABLE INITIALLY DEFERRED; ALTER TABLE producers ADD FOREIGN KEY (rgraph) REFERENCES relgraphs (id); ALTER TABLE producers_relations ADD FOREIGN KEY (pid1) REFERENCES producers_rev (id); |