Merge pull request #11 from 8thlight/add_postgraphile_subscription

Add Postgraphile subscription exposure for price feed
This commit is contained in:
Takayuki Goto
2018-09-17 11:53:47 -05:00
committed by GitHub
25 changed files with 5185 additions and 0 deletions
@@ -0,0 +1 @@
DROP TRIGGER notify_pricefeeds ON maker.price_feeds;
@@ -0,0 +1,13 @@
CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$
BEGIN
PERFORM pg_notify(
CAST('postgraphile:price_feed' AS text),
row_to_json(NEW)::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER notify_pricefeeds
AFTER INSERT ON maker.price_feeds
FOR EACH ROW
EXECUTE PROCEDURE notify_pricefeed();