Skip to content

Commit

Permalink
Merge merlin.status_t and scheduer.status_t into util_functions.reque…
Browse files Browse the repository at this point in the history
…st_status

[Hasura is currently unable to properly use custom types not in the public schema] (hasura/graphql-engine#4630). While this can be partially circumvented by specifying a search_path in the connection string (see change to Docker Compose), because these two types share a name, Hasura would always match to the type specified in the first listed schema in the search path. Because these types are identical sans the originating DB, they were combined into a singular type, `request_status`, rather than renaming each one.
  • Loading branch information
Mythicaeda committed Apr 15, 2024
1 parent c5fec88 commit 57dfc32
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions deployment/postgres-init-db/sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ begin;

-- Util Functions
\ir functions/util_functions/shared_update_functions.sql
\ir types/util_functions/request_status.sql

-- Permissions
\ir init_permissions.sql
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
create type merlin.status_t as enum('pending', 'incomplete', 'failed', 'success');

create table merlin.simulation_dataset (
id integer generated always as identity,
simulation_id integer not null,
Expand All @@ -23,7 +21,7 @@ create table merlin.simulation_dataset (
simulation_end_time timestamptz not null,

-- Simulation state
status merlin.status_t not null default 'pending',
status util_functions.request_status not null default 'pending',
reason jsonb null,
canceled boolean not null default false,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
create type scheduler.status_t as enum('pending', 'incomplete', 'failed', 'success');

create table scheduler.scheduling_request (
analysis_id integer generated always as identity,
specification_id integer not null,
Expand All @@ -9,7 +7,7 @@ create table scheduler.scheduling_request (
plan_revision integer not null,

-- Scheduling State
status scheduler.status_t not null default 'pending',
status util_functions.request_status not null default 'pending',
reason jsonb null,
canceled boolean not null default false,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create type util_functions.request_status as enum('pending', 'incomplete', 'failed', 'success');
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ services:
container_name: aerie_hasura
depends_on: ["postgres"]
environment:
AERIE_DATABASE_URL: "postgres://${AERIE_USERNAME}:${AERIE_PASSWORD}@postgres:5432/aerie"
AERIE_DATABASE_URL: "postgres://${AERIE_USERNAME}:${AERIE_PASSWORD}@postgres:5432/aerie?options=-c%20search_path%3Dutil_functions%2Chasura%2Cpermissions%2Ctags%2Cmerlin%2Cscheduler%2Csequencing%2Cpublic"
AERIE_MERLIN_URL: "http://aerie_merlin:27183"
AERIE_SCHEDULER_URL: "http://aerie_scheduler:27185"
AERIE_SEQUENCING_URL: "http://aerie_sequencing:27184"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
private final @Language("SQL") String sql = """
update merlin.simulation_dataset
set
status = ?::status_t,
status = ?::util_functions.request_status,
reason = ?::json
where dataset_id = ?
""";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
private static final @Language("SQL") String sql = """
update scheduler.scheduling_request
set
status = ?::status_t,
status = ?::util_functions.request_status,
reason = ?::json,
dataset_id = ?
where
Expand Down

0 comments on commit 57dfc32

Please sign in to comment.