mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
a66fb42ce2
* Separate DB and metadata migrations * Refactor Migrate.hs to generate list of migrations at compile-time * Replace ginger with shakespeare to improve performance * Improve migration log messages
27 lines
779 B
PL/PgSQL
27 lines
779 B
PL/PgSQL
CREATE TABLE hdb_catalog.hdb_schema_update_event (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
instance_id uuid NOT NULL,
|
|
occurred_at timestamptz NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE FUNCTION hdb_catalog.hdb_schema_update_event_notifier() RETURNS trigger AS
|
|
$function$
|
|
DECLARE
|
|
instance_id uuid;
|
|
occurred_at timestamptz;
|
|
curr_rec record;
|
|
BEGIN
|
|
instance_id = NEW.instance_id;
|
|
occurred_at = NEW.occurred_at;
|
|
PERFORM pg_notify('hasura_schema_update', json_build_object(
|
|
'instance_id', instance_id,
|
|
'occurred_at', occurred_at
|
|
)::text);
|
|
RETURN curr_rec;
|
|
END;
|
|
$function$
|
|
LANGUAGE plpgsql;
|
|
|
|
CREATE TRIGGER hdb_schema_update_event_notifier AFTER INSERT ON hdb_catalog.hdb_schema_update_event
|
|
FOR EACH ROW EXECUTE PROCEDURE hdb_catalog.hdb_schema_update_event_notifier();
|