diff --git a/deployment/hasura/migrations/Aerie/8_span_event_linkage/down.sql b/deployment/hasura/migrations/Aerie/8_span_event_linkage/down.sql new file mode 100644 index 0000000000..2322ef3d1a --- /dev/null +++ b/deployment/hasura/migrations/Aerie/8_span_event_linkage/down.sql @@ -0,0 +1,11 @@ +-- event table revert +alter table merlin.event + drop column span_index; + +-- span table revert +alter table merlin.span + drop constraint dataset_span_index_unique; + +alter table merlin.span + drop column span_index; + diff --git a/deployment/hasura/migrations/Aerie/8_span_event_linkage/up.sql b/deployment/hasura/migrations/Aerie/8_span_event_linkage/up.sql new file mode 100644 index 0000000000..3c65a03870 --- /dev/null +++ b/deployment/hasura/migrations/Aerie/8_span_event_linkage/up.sql @@ -0,0 +1,15 @@ +-- Span Table update +alter table merlin.span + add column span_index integer; + +update merlin.span +set span_index = id; + +alter table merlin.span + alter column span_index set not null, + add constraint dataset_span_index_unique + unique (dataset_id, span_index); + +-- event table update +alter table merlin.event + add column span_index integer not null;