From 6d921d5b3aae35c44e0e1de1be5330c021b6dc1e Mon Sep 17 00:00:00 2001 From: Fabian Engelniederhammer Date: Mon, 8 Jul 2024 17:36:04 +0200 Subject: [PATCH] refactor: delete alias to make SQL statement easier to follow --- .../main/resources/db/migration/V1__init.sql | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/backend/src/main/resources/db/migration/V1__init.sql b/backend/src/main/resources/db/migration/V1__init.sql index e39237552..4274ef37b 100644 --- a/backend/src/main/resources/db/migration/V1__init.sql +++ b/backend/src/main/resources/db/migration/V1__init.sql @@ -106,30 +106,30 @@ from create view sequence_entries_view as select - se.*, - sepd.started_processing_at, - sepd.finished_processing_at, - sepd.processed_data as processed_data, - sepd.processed_data || em.joint_metadata as joint_metadata, - sepd.errors, - sepd.warnings, + sequence_entries.*, + sequence_entries_preprocessed_data.started_processing_at, + sequence_entries_preprocessed_data.finished_processing_at, + sequence_entries_preprocessed_data.processed_data as processed_data, + sequence_entries_preprocessed_data.processed_data || external_metadata_view.joint_metadata as joint_metadata, + sequence_entries_preprocessed_data.errors, + sequence_entries_preprocessed_data.warnings, case - when se.released_at is not null then 'APPROVED_FOR_RELEASE' - when se.is_revocation then 'AWAITING_APPROVAL' - when sepd.processing_status = 'IN_PROCESSING' then 'IN_PROCESSING' - when sepd.processing_status = 'HAS_ERRORS' then 'HAS_ERRORS' - when sepd.processing_status = 'FINISHED' then 'AWAITING_APPROVAL' + when sequence_entries.released_at is not null then 'APPROVED_FOR_RELEASE' + when sequence_entries.is_revocation then 'AWAITING_APPROVAL' + when sequence_entries_preprocessed_data.processing_status = 'IN_PROCESSING' then 'IN_PROCESSING' + when sequence_entries_preprocessed_data.processing_status = 'HAS_ERRORS' then 'HAS_ERRORS' + when sequence_entries_preprocessed_data.processing_status = 'FINISHED' then 'AWAITING_APPROVAL' else 'RECEIVED' end as status from - sequence_entries se - left join sequence_entries_preprocessed_data sepd on - se.accession = sepd.accession - and se.version = sepd.version - and sepd.pipeline_version = (select version from current_processing_pipeline) - left join external_metadata_view em on - se.accession = em.accession - and se.version = em.version; + sequence_entries + left join sequence_entries_preprocessed_data on + sequence_entries.accession = sequence_entries_preprocessed_data.accession + and sequence_entries.version = sequence_entries_preprocessed_data.version + and sequence_entries_preprocessed_data.pipeline_version = (select version from current_processing_pipeline) + left join external_metadata_view on + sequence_entries.accession = external_metadata_view.accession + and sequence_entries.version = external_metadata_view.version; create table metadata_upload_aux_table ( accession text,