925b1b0b1c
- This reverts commit 4e2536bf421fd9d2c9067d81f30e0f45c6b94fe7. - Restore timestamped migrations so goose fix can handle ordering dynamically with plugins also supplying timestamp based migrations
22 lines
522 B
PL/PgSQL
22 lines
522 B
PL/PgSQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
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;
|
|
-- +goose StatementEnd
|
|
|
|
CREATE TRIGGER notify_pricefeeds
|
|
AFTER INSERT ON maker.price_feeds
|
|
FOR EACH ROW
|
|
EXECUTE PROCEDURE notify_pricefeed();
|
|
|
|
|
|
-- +goose Down
|
|
DROP TRIGGER notify_pricefeeds ON maker.price_feeds;
|