From 929643132afad446886d9527012719e2ec871d9f Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman Date: Thu, 1 Nov 2018 15:12:04 -0500 Subject: [PATCH] Squash price feed trigger update into original migration --- .../1536702963_add_price_feed_trigger.up.sql | 3 ++- ...537979235_update_price_feeds_trigger.down.sql | 15 --------------- .../1537979235_update_price_feeds_trigger.up.sql | 16 ---------------- 3 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 db/migrations/1537979235_update_price_feeds_trigger.down.sql delete mode 100644 db/migrations/1537979235_update_price_feeds_trigger.up.sql 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();