MCPcopy Create free account
hub / github.com/subquery/subql / createSchemaTriggerFunction

Function createSchemaTriggerFunction

packages/node-core/src/db/sync-helper.ts:289–300  ·  view source on GitHub ↗
(schema: string)

Source from the content-addressed store, hash-verified

287}
288
289export function createSchemaTriggerFunction(schema: string): string {
290 return `
291 CREATE OR REPLACE FUNCTION "${schema}".schema_notification()
292 RETURNS trigger AS $$
293 BEGIN
294 PERFORM pg_notify(
295 '${hashName(schema, 'schema_channel', '_metadata')}',
296 'schema_updated');
297 RETURN NULL;
298 END;
299 $$ LANGUAGE plpgsql;`;
300}
301
302export function createRewindTrigger(schema: string): string {
303 const triggerName = hashName(schema, 'rewind_trigger', '_global');

Callers 1

Calls 1

hashNameFunction · 0.90

Tested by

no test coverage detected