Ledger api server index h2 avoid reliance on PUBLIC schema (#8223)

by replacing entire `participant_command_completions` table to
prevent assumption that tables reside in the `PUBLIC` schema
which they are not in canton. This is follow-up to #8035

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Oliver Seeliger 2020-12-10 10:11:47 +01:00 committed by GitHub
parent 029c655adc
commit e23f44f47d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View File

@ -1 +1 @@
8a053db9de2974d5ecb2b36c7f2bb878340de7974b7a88bb81ec58155253a67c
dad4724c58c6925c2620a11275cb6ca9029a816d5c1b2bde7e2bb3c0c804e6d6

View File

@ -5,8 +5,27 @@ alter table participant_events add column submitters array;
update participant_events set submitters = array[submitter];
alter table participant_events drop column submitter;
alter table participant_command_completions add column submitters array;
update participant_command_completions set submitters = array[submitting_party];
-- Replace the participant_command_completions table created in V11__Create_command_completions_table.sql
-- where the index on participant_command_completions(completion_offset, application_id, submitting_party) was not named
-- thus motivating the replacement of the entire table here.
alter table participant_command_completions rename to participant_command_completions_to_be_dropped;
create table participant_command_completions (
completion_offset binary not null,
record_time timestamp not null,
application_id varchar not null,
submitters array,
command_id varchar not null,
transaction_id varchar, -- null if the command was rejected and checkpoints
status_code integer, -- null for successful command and checkpoints
status_message varchar -- null for successful command and checkpoints
);
insert into participant_command_completions (completion_offset, record_time, application_id, submitters, command_id, transaction_id, status_code, status_message)
select completion_offset, record_time, application_id, array[submitting_party], command_id, transaction_id, status_code, status_message
from participant_command_completions_to_be_dropped;
create index participant_command_completions_idx on participant_command_completions(completion_offset, application_id, submitters);
drop index PUBLIC.INDEX_2;
alter table participant_command_completions drop column submitting_party;
drop table participant_command_completions_to_be_dropped;