Skip to content

Commit

Permalink
Merge pull request #1461 from NASA-AMMOS/feature/add-default-mission-…
Browse files Browse the repository at this point in the history
…model-view

Added a table to track the default view for a given mission model
  • Loading branch information
cohansen authored Jun 6, 2024
2 parents f003e03 + 2d17e09 commit 97f746d
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 136 deletions.
269 changes: 136 additions & 133 deletions deployment/hasura/metadata/databases/tables/merlin/mission_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,165 +4,168 @@ table:
configuration:
custom_name: "mission_model"
object_relationships:
- name: parameters
using:
foreign_key_constraint_on:
column: model_id
table:
name: mission_model_parameters
schema: merlin
- name: uploaded_file
using:
foreign_key_constraint_on: jar_id
- name: parameters
using:
foreign_key_constraint_on:
column: model_id
table:
name: mission_model_parameters
schema: merlin
- name: uploaded_file
using:
foreign_key_constraint_on: jar_id
- name: view
using:
foreign_key_constraint_on: default_view_id
array_relationships:
- name: activity_types
using:
foreign_key_constraint_on:
column: model_id
table:
name: activity_type
schema: merlin
- name: constraint_specification
using:
foreign_key_constraint_on:
column: model_id
table:
name: constraint_model_specification
schema: merlin
- name: plans
using:
foreign_key_constraint_on:
column: model_id
table:
name: plan
schema: merlin
- name: resource_types
using:
foreign_key_constraint_on:
column: model_id
table:
name: resource_type
schema: merlin
- name: scheduling_specification_conditions
using:
foreign_key_constraint_on:
column: model_id
table:
name: scheduling_model_specification_conditions
schema: scheduler
- name: scheduling_specification_goals
using:
foreign_key_constraint_on:
column: model_id
table:
name: scheduling_model_specification_goals
schema: scheduler
- name: refresh_activity_type_logs
using:
manual_configuration:
remote_table:
name: refresh_activity_type_logs
schema: hasura
column_mapping:
id: model_id
- name: refresh_model_parameter_logs
using:
manual_configuration:
remote_table:
name: refresh_model_parameter_logs
schema: hasura
column_mapping:
id: model_id
- name: refresh_resource_type_logs
using:
manual_configuration:
remote_table:
name: refresh_resource_type_logs
schema: hasura
column_mapping:
id: model_id
- name: activity_types
using:
foreign_key_constraint_on:
column: model_id
table:
name: activity_type
schema: merlin
- name: constraint_specification
using:
foreign_key_constraint_on:
column: model_id
table:
name: constraint_model_specification
schema: merlin
- name: plans
using:
foreign_key_constraint_on:
column: model_id
table:
name: plan
schema: merlin
- name: resource_types
using:
foreign_key_constraint_on:
column: model_id
table:
name: resource_type
schema: merlin
- name: scheduling_specification_conditions
using:
foreign_key_constraint_on:
column: model_id
table:
name: scheduling_model_specification_conditions
schema: scheduler
- name: scheduling_specification_goals
using:
foreign_key_constraint_on:
column: model_id
table:
name: scheduling_model_specification_goals
schema: scheduler
- name: refresh_activity_type_logs
using:
manual_configuration:
remote_table:
name: refresh_activity_type_logs
schema: hasura
column_mapping:
id: model_id
- name: refresh_model_parameter_logs
using:
manual_configuration:
remote_table:
name: refresh_model_parameter_logs
schema: hasura
column_mapping:
id: model_id
- name: refresh_resource_type_logs
using:
manual_configuration:
remote_table:
name: refresh_resource_type_logs
schema: hasura
column_mapping:
id: model_id
select_permissions:
- role: aerie_admin
permission:
columns: '*'
columns: "*"
filter: {}
allow_aggregations: true
- role: user
permission:
columns: '*'
columns: "*"
filter: {}
allow_aggregations: true
- role: viewer
permission:
columns: '*'
columns: "*"
filter: {}
allow_aggregations: true
insert_permissions:
- role: aerie_admin
permission:
columns: [mission, name, version, description, jar_id]
columns: [mission, name, version, description, jar_id, default_view_id]
check: {}
set:
owner: 'x-hasura-user-id'
owner: "x-hasura-user-id"
update_permissions:
- role: aerie_admin
permission:
columns: [mission, name, version, description, owner]
columns: [mission, name, version, description, owner, default_view_id]
filter: {}
delete_permissions:
- role: aerie_admin
permission:
filter: {}

event_triggers:
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- id
- revision
- jar_id
- mission
- name
- version
- owner
name: refreshActivityTypes
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshActivityTypes"
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- id
- revision
- jar_id
- mission
- name
- version
- owner
name: refreshModelParameters
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshModelParameters"
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- jar_id
name: refreshResourceTypes
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshResourceTypes"
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- id
- revision
- jar_id
- mission
- name
- version
- owner
name: refreshActivityTypes
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshActivityTypes"
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- id
- revision
- jar_id
- mission
- name
- version
- owner
name: refreshModelParameters
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshModelParameters"
- definition:
enable_manual: false
insert:
columns: "*"
update:
columns:
- jar_id
name: refreshResourceTypes
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 300
webhook: "{{AERIE_MERLIN_URL}}/refreshResourceTypes"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table merlin.mission_model
drop column default_view_id;

call migrations.mark_migration_rolled_back('4');
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alter table merlin.mission_model
add column default_view_id integer default null,

add foreign key (default_view_id)
references ui.view (id)
on delete set null;

comment on column merlin.mission_model.default_view_id is e''
'The ID of an option default view for the mission model.';

call migrations.mark_migration_applied('4');
1 change: 1 addition & 0 deletions deployment/postgres-init-db/sql/applied_migrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ call migrations.mark_migration_applied('0');
call migrations.mark_migration_applied('1');
call migrations.mark_migration_applied('2');
call migrations.mark_migration_applied('3');
call migrations.mark_migration_applied('4');
6 changes: 3 additions & 3 deletions deployment/postgres-init-db/sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ begin;
\ir tables/tags/tags.sql
\ir functions/tags/get_tags.sql

-- UI
\ir init_ui.sql

-- Merlin
\ir init_merlin.sql

Expand All @@ -33,9 +36,6 @@ begin;
-- Sequencing
\ir init_sequencing.sql

-- UI
\ir init_ui.sql

-- Tags
\ir init_tags.sql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ create table merlin.mission_model (
name text not null,
version text not null,
description text not null default '',
default_view_id integer default null,

owner text,
jar_id integer not null,
Expand All @@ -24,6 +25,9 @@ create table merlin.mission_model (
constraint mission_model_owner_exists
foreign key (owner) references permissions.users
on update cascade
on delete set null,
foreign key (default_view_id)
references ui.view
on delete set null
);

Expand All @@ -48,6 +52,8 @@ comment on column merlin.mission_model.created_at is e''
'The time this mission model was uploaded into Aerie.';
comment on column merlin.mission_model.description is e''
'A human-meaningful description of the mission model.';
comment on column merlin.mission_model.default_view_id is e''
'The ID of an optional default view for the mission model.';

create trigger increment_revision_mission_model_update
before update on merlin.mission_model
Expand Down

0 comments on commit 97f746d

Please sign in to comment.