Files
archtika/rest-api/db/migrations/20240720073454_automatic_schema_cache_reloading.sql

20 lines
340 B
MySQL
Raw Normal View History

2024-07-31 07:23:32 +02:00
-- migrate:up
2024-10-03 18:51:30 +02:00
CREATE FUNCTION internal.pgrst_watch ()
RETURNS EVENT_TRIGGER
AS $$
2024-07-31 07:23:32 +02:00
BEGIN
NOTIFY pgrst,
'reload schema';
2024-07-31 07:23:32 +02:00
END;
$$
LANGUAGE plpgsql;
2024-07-31 07:23:32 +02:00
CREATE EVENT TRIGGER pgrst_watch ON ddl_command_end
2024-10-03 18:51:30 +02:00
EXECUTE FUNCTION internal.pgrst_watch ();
2024-07-31 07:23:32 +02:00
-- migrate:down
DROP EVENT TRIGGER pgrst_watch;
2024-10-03 18:51:30 +02:00
DROP FUNCTION internal.pgrst_watch ();