-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from NASA-AMMOS/feat/user-sequence
[AERIE-1982] feat: add user sequence table
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
command-expansion-server/sql/commanding/tables/user_sequence.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
create table user_sequence ( | ||
authoring_command_dict_id integer not null, | ||
created_at timestamptz not null default now(), | ||
definition text not null, | ||
id integer generated always as identity, | ||
name text not null, | ||
owner text not null default 'unknown', | ||
updated_at timestamptz not null default now(), | ||
|
||
constraint user_sequence_primary_key primary key (id) | ||
); | ||
|
||
comment on column user_sequence.authoring_command_dict_id is e'' | ||
'Command dictionary the user sequence was created with.'; | ||
comment on column user_sequence.created_at is e'' | ||
'Time the user sequence was created.'; | ||
comment on column user_sequence.definition is e'' | ||
'The user sequence definition string.'; | ||
comment on column user_sequence.id is e'' | ||
'ID of the user sequence.'; | ||
comment on column user_sequence.name is e'' | ||
'Human-readable name of the user sequence.'; | ||
comment on column user_sequence.owner is e'' | ||
'Username of the user sequence owner.'; | ||
comment on column user_sequence.updated_at is e'' | ||
'Time the user sequence was last updated.'; | ||
|
||
create or replace function user_sequence_set_updated_at() | ||
returns trigger | ||
security definer | ||
language plpgsql as $$begin | ||
new.updated_at = now(); | ||
return new; | ||
end$$; | ||
|
||
create trigger set_timestamp | ||
before update on user_sequence | ||
for each row | ||
execute function user_sequence_set_updated_at(); |
13 changes: 13 additions & 0 deletions
13
deployment/hasura/metadata/databases/AerieCommanding/tables/public_user_sequence.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
table: | ||
name: user_sequence | ||
schema: public | ||
object_relationships: | ||
- name: command_dictionary | ||
using: | ||
manual_configuration: | ||
remote_table: | ||
schema: public | ||
name: command_dictionary | ||
insertion_order: null | ||
column_mapping: | ||
authoring_command_dict_id: id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters