diff --git a/hasura/config.yaml b/hasura/config.yaml new file mode 100644 index 000000000..d13faa054 --- /dev/null +++ b/hasura/config.yaml @@ -0,0 +1,7 @@ +version: 3 +endpoint: http://localhost:8080 +admin_secret: myadminsecretkey +metadata_directory: metadata +actions: + kind: synchronous + handler_webhook_baseurl: http://localhost:3000 diff --git a/hasura/metadata/actions.graphql b/hasura/metadata/actions.graphql new file mode 100644 index 000000000..e69de29bb diff --git a/hasura/metadata/actions.yaml b/hasura/metadata/actions.yaml new file mode 100644 index 000000000..1edb4c2ff --- /dev/null +++ b/hasura/metadata/actions.yaml @@ -0,0 +1,6 @@ +actions: [] +custom_types: + enums: [] + input_objects: [] + objects: [] + scalars: [] diff --git a/hasura/metadata/allow_list.yaml b/hasura/metadata/allow_list.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/metadata/allow_list.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/metadata/cron_triggers.yaml b/hasura/metadata/cron_triggers.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/metadata/cron_triggers.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/metadata/databases/databases.yaml b/hasura/metadata/databases/databases.yaml new file mode 100644 index 000000000..65a11b202 --- /dev/null +++ b/hasura/metadata/databases/databases.yaml @@ -0,0 +1,14 @@ +- name: default + kind: postgres + configuration: + connection_info: + database_url: + from_env: HASURA_GRAPHQL_DATABASE_URL + isolation_level: read-committed + pool_settings: + connection_lifetime: 600 + idle_timeout: 180 + max_connections: 50 + retries: 1 + use_prepared_statements: true + tables: "!include default/tables/tables.yaml" diff --git a/hasura/metadata/databases/default/tables/public_indexer_log_entries.yaml b/hasura/metadata/databases/default/tables/public_indexer_log_entries.yaml new file mode 100644 index 000000000..c95174150 --- /dev/null +++ b/hasura/metadata/databases/default/tables/public_indexer_log_entries.yaml @@ -0,0 +1,23 @@ +table: + name: indexer_log_entries + schema: public +insert_permissions: +- permission: + check: {} + columns: + - block_height + - function_name + - message + - timestamp + - id + role: append +select_permissions: +- permission: + columns: + - block_height + - function_name + - message + - timestamp + - id + filter: {} + role: append diff --git a/hasura/metadata/databases/default/tables/public_indexer_state.yaml b/hasura/metadata/databases/default/tables/public_indexer_state.yaml new file mode 100644 index 000000000..51084d5a3 --- /dev/null +++ b/hasura/metadata/databases/default/tables/public_indexer_state.yaml @@ -0,0 +1,31 @@ +table: + name: indexer_state + schema: public +insert_permissions: +- permission: + check: {} + columns: + - function_name + - current_block_height + - current_historical_block_height + - status + role: append +select_permissions: +- permission: + columns: + - function_name + - current_block_height + - current_historical_block_height + - status + filter: {} + role: append +update_permissions: +- permission: + check: {} + columns: + - function_name + - current_block_height + - current_historical_block_height + - status + filter: {} + role: append diff --git a/hasura/metadata/databases/default/tables/tables.yaml b/hasura/metadata/databases/default/tables/tables.yaml new file mode 100644 index 000000000..fb74b4277 --- /dev/null +++ b/hasura/metadata/databases/default/tables/tables.yaml @@ -0,0 +1,2 @@ +- "!include public_indexer_log_entries.yaml" +- "!include public_indexer_state.yaml" diff --git a/hasura/metadata/query_collections.yaml b/hasura/metadata/query_collections.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/metadata/query_collections.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/metadata/remote_schemas.yaml b/hasura/metadata/remote_schemas.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/metadata/remote_schemas.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/metadata/rest_endpoints.yaml b/hasura/metadata/rest_endpoints.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/metadata/rest_endpoints.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/metadata/version.yaml b/hasura/metadata/version.yaml new file mode 100644 index 000000000..0a70affa4 --- /dev/null +++ b/hasura/metadata/version.yaml @@ -0,0 +1 @@ +version: 3 diff --git a/hasura/migrations/default/1691364619300_init/down.sql b/hasura/migrations/default/1691364619300_init/down.sql new file mode 100644 index 000000000..9ba2f7739 --- /dev/null +++ b/hasura/migrations/default/1691364619300_init/down.sql @@ -0,0 +1,2 @@ +DROP TABLE public.indexer_log_entries; +DROP TABLE public.indexer_state; diff --git a/hasura/migrations/default/1691364619300_init/up.sql b/hasura/migrations/default/1691364619300_init/up.sql new file mode 100644 index 000000000..9b7f5dd94 --- /dev/null +++ b/hasura/migrations/default/1691364619300_init/up.sql @@ -0,0 +1,18 @@ +SET check_function_bodies = false; +CREATE TABLE public.indexer_log_entries ( + id uuid DEFAULT gen_random_uuid() NOT NULL, + function_name text NOT NULL, + block_height numeric NOT NULL, + "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);