mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-13 00:12:54 +00:00
vanilla pg dokcer image setup
This commit is contained in:
22
proxy/dev/sql/include/pgrst.sql
Normal file
22
proxy/dev/sql/include/pgrst.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
-- code to monitor the last schema update
|
||||
CREATE SCHEMA IF NOT EXISTS pgrst;
|
||||
|
||||
ALTER ROLE authenticator SET pgrst.last_schema_updated = now()::text;
|
||||
-- Create an event trigger function
|
||||
CREATE OR REPLACE FUNCTION pgrst.pgrst_watch() RETURNS event_trigger
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
ALTER ROLE authenticator SET pgrst.last_schema_updated = now()::text;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pgrst.last_schema_updated() RETURNS text
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
SELECT current_setting('pgrst.last_schema_updated', true);
|
||||
$$;
|
||||
|
||||
-- This event trigger will fire after every ddl_command_end event
|
||||
CREATE EVENT TRIGGER pgrst.pgrst_watch
|
||||
ON ddl_command_end
|
||||
EXECUTE PROCEDURE pgrst.pgrst_watch();
|
||||
Reference in New Issue
Block a user