From b80842f31d817d5dc2f187c0e515b34acd3bd0d8 Mon Sep 17 00:00:00 2001 From: Morgan McCauley Date: Thu, 28 Sep 2023 08:58:38 +1300 Subject: [PATCH] feat: Add `indexer_log_entries` indexes to `hasura` migrations (#238) --- hasura/migrations/default/1691364619300_init/up.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hasura/migrations/default/1691364619300_init/up.sql b/hasura/migrations/default/1691364619300_init/up.sql index 9b7f5dd94..4c1dad71f 100644 --- a/hasura/migrations/default/1691364619300_init/up.sql +++ b/hasura/migrations/default/1691364619300_init/up.sql @@ -1,4 +1,5 @@ SET check_function_bodies = false; + CREATE TABLE public.indexer_log_entries ( id uuid DEFAULT gen_random_uuid() NOT NULL, function_name text NOT NULL, @@ -6,13 +7,19 @@ CREATE TABLE public.indexer_log_entries ( "timestamp" timestamp without time zone DEFAULT CURRENT_TIMESTAMP, message text ); + CREATE TABLE public.indexer_state ( function_name character varying NOT NULL, current_block_height numeric(21,0) NOT NULL, status text, current_historical_block_height numeric(21,0) ); + ALTER TABLE ONLY public.indexer_log_entries ADD CONSTRAINT indexer_log_entries_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.indexer_state ADD CONSTRAINT indexer_state_pkey PRIMARY KEY (function_name); + +CREATE INDEX idx_function_name ON indexer_log_entries(function_name); +CREATE INDEX idx_timestamp ON indexer_log_entries("timestamp");