diff --git a/db/migrations/1536702963_add_price_feed_trigger.up.sql b/db/migrations/1536702963_add_price_feed_trigger.up.sql index 1e8f9d6c..1127c8e2 100644 --- a/db/migrations/1536702963_add_price_feed_trigger.up.sql +++ b/db/migrations/1536702963_add_price_feed_trigger.up.sql @@ -2,7 +2,8 @@ CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$ BEGIN PERFORM pg_notify( CAST('postgraphile:price_feed' AS text), - row_to_json(NEW)::text); + json_build_object('__node__', json_build_array('price_feeds', NEW.id))::text + ); RETURN NEW; END; $$ LANGUAGE plpgsql; diff --git a/db/migrations/1537979235_update_price_feeds_trigger.down.sql b/db/migrations/1537979235_update_price_feeds_trigger.down.sql deleted file mode 100644 index 952cec40..00000000 --- a/db/migrations/1537979235_update_price_feeds_trigger.down.sql +++ /dev/null @@ -1,15 +0,0 @@ -DROP TRIGGER notify_pricefeeds ON maker.price_feeds; - -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(); diff --git a/db/migrations/1537979235_update_price_feeds_trigger.up.sql b/db/migrations/1537979235_update_price_feeds_trigger.up.sql deleted file mode 100644 index 989ef859..00000000 --- a/db/migrations/1537979235_update_price_feeds_trigger.up.sql +++ /dev/null @@ -1,16 +0,0 @@ -DROP TRIGGER notify_pricefeeds ON maker.price_feeds; - -CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$ -BEGIN - PERFORM pg_notify( - CAST('postgraphile:price_feed' AS text), - json_build_object('__node__', json_build_array('price_feeds', NEW.id))::text - ); - RETURN NEW; -END; -$$ LANGUAGE plpgsql; - -CREATE TRIGGER notify_pricefeeds - AFTER INSERT ON maker.price_feeds - FOR EACH ROW - EXECUTE PROCEDURE notify_pricefeed();