From 391de53e2db5f577684d5b2cec5012f63657c273 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Fri, 4 Dec 2020 16:42:33 +0000 Subject: [PATCH] Bump to version 1.16.0, prepare release --- docs/list_of_procs.rst | 4 +- docs/list_of_tables_and_columns.rst | 1 + schema/lookups.sql | 6 +- schema/routines.sql | 1266 ++++++++++++++++- schema/tables.sql | 5 +- .../2020_12_04_AdminVar_bump_version.sql | 5 + 6 files changed, 1279 insertions(+), 8 deletions(-) create mode 100644 schema/updates/2020_12_04_AdminVar_bump_version.sql diff --git a/docs/list_of_procs.rst b/docs/list_of_procs.rst index da4430fa..d6fa3dfc 100644 --- a/docs/list_of_procs.rst +++ b/docs/list_of_procs.rst @@ -69,9 +69,9 @@ "**retrieve_processing_programs_for_job_id**","p_id int unsigned","Returns a multi-row result-set with processing program instances for the given processing job ID" "**retrieve_processing_programs_for_job_id_v2**","p_id int unsigned, p_authLogin varchar(45)","Returns a multi-row result-set with processing program instances for the given processing job ID" "**retrieve_processing_program_attachments_for_dc_group_and_program**","p_id int unsigned, p_program varchar(255)","Returns a multi-row result-set with the processing program attachments for the given DC group ID" - "**retrieve_processing_program_attachments_for_dc_group_program_v2**","p_id int unsigned, p_program varchar(255), p_authLogin varchar(45)","Returns a multi-row result-set with the processing program attachments for the given DC group ID" + "**retrieve_processing_program_attachments_for_dc_group_program_v2**","p_id int unsigned, p_program varchar(255), p_authLogin varchar(45)","Returns a multi-row result-set with the processing program attachments for the given DC group ID" "**retrieve_processing_program_attachments_for_program_id**","p_id int unsigned","Returns a multi-row result-set with the processing program attachments for the given processing program id" - "**retrieve_processing_program_attachments_for_program_id_v2**","p_id int unsigned, p_authLogin varchar(45)","Returns a multi-row result-set with the processing program attachments for the given processing program id" + "**retrieve_processing_program_attachments_for_program_id_v2**","p_id int unsigned, p_authLogin varchar(45)","Returns a multi-row result-set with the processing program attachments for the given processing program id" "**retrieve_proposal_title**","p_proposal_code varchar(5), p_proposal_number int","Returns a single-row, single-column result set with the title of the proposal p_proposal_code + p_proposal_number" "**retrieve_proposal_title**","p_proposal_code varchar(5), p_proposal_number int, p_authLogin varchar(45)","Returns a single-row, single-column result set with the title of the proposal p_proposal_code + p_proposal_number" "**retrieve_reprocessing_by_dc**","p_dcId int(11) unsigned","Retrieves reprocessing requests for a data collection (p_dcId)." diff --git a/docs/list_of_tables_and_columns.rst b/docs/list_of_tables_and_columns.rst index 9763c840..b35a5480 100644 --- a/docs/list_of_tables_and_columns.rst +++ b/docs/list_of_tables_and_columns.rst @@ -510,6 +510,7 @@ ``containerRegistryId``,int,"" ``scLocationUpdated``,datetime,"" ``priorityPipelineId``,int,"" + ``experimentTypeId``,int,"" **ContainerHistory**,table,"" ``containerHistoryId``,int,"" ``containerId``,int,"" diff --git a/schema/lookups.sql b/schema/lookups.sql index 83711b15..a5b4cfcd 100644 --- a/schema/lookups.sql +++ b/schema/lookups.sql @@ -19,7 +19,7 @@ -- /*!40000 ALTER TABLE `AdminVar` DISABLE KEYS */; -INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.15.2'); +INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.16.0'); /*!40000 ALTER TABLE `AdminVar` ENABLE KEYS */; -- @@ -27,7 +27,7 @@ INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.1 -- /*!40000 ALTER TABLE `SchemaStatus` DISABLE KEYS */; -INSERT INTO `SchemaStatus` (`schemaStatusId`, `scriptName`, `schemaStatus`, `recordTimeStamp`) VALUES (6,'20180213_BLSample_subLocation.sql','DONE','2018-02-13 13:27:19'),(12,'20180213_DataCollectionFileAttachment_fileType.sql','DONE','2018-02-13 15:12:54'),(16,'20180303_v_run_to_table.sql','DONE','2018-07-25 15:11:18'),(19,'20180328_ImageQualityIndicators_alter_table.sql','DONE','2018-07-25 15:11:18'),(22,'20180410_BeamLineSetup_alter.sql','DONE','2018-07-25 15:11:18'),(25,'20180413_BeamLineSetup_and_Detector_alter.sql','DONE','2018-07-25 15:11:18'),(28,'20180501_DataCollectionGroup_experimentType_enum.sql','DONE','2018-07-25 15:11:18'),(31,'20180531_ScreeningOutput_alignmentSuccess.sql','DONE','2018-07-25 15:11:18'),(34,'20180629_DataCollection_imageContainerSubPath.sql','DONE','2018-07-25 15:11:18'),(35,'20180913_BeamCalendar.sql','DONE','2018-09-19 09:52:45'),(36,'2018_09_19_DataCollection_imageDirectory_comment.sql','DONE','2018-09-19 12:38:01'),(37,'2018_09_27_increase_schema_version.sql','DONE','2018-09-27 13:17:15'),(38,'2018_11_01_XrayCenteringResult.sql','DONE','2018-11-01 13:36:53'),(39,'2018_11_01_AutoProcProgram_dataCollectionId.sql','DONE','2018-11-01 15:10:38'),(40,'2018_11_01_AutoProcProgramMessage.sql','DONE','2018-11-01 15:28:17'),(44,'2018_11_01_DiffractionPlan_centeringMethod.sql','DONE','2018-11-01 22:51:36'),(45,'2018_11_02_DataCollectionGroup_experimentType_enum.sql','DONE','2018-11-02 11:54:15'),(47,'2018_11_05_spelling_of_centring.sql','DONE','2018-11-05 15:31:38'),(48,'2018_11_09_AutoProcProgram_update_processing_program.sql','DONE','2018-11-09 16:38:34'),(49,'2018_11_14_AutoProcProgramMessage_autoinc.sql','DONE','2018-11-14 10:15:27'),(50,'2018_11_22_AutoProcProgram_processingStatus_update.sql','DONE','2018-11-22 16:11:15'),(51,'2018_12_04_EnergyScan_and_XFEFluorescenceSpectrum_add_axisPosition.sql','DONE','2018-12-04 14:13:23'),(52,'2018_12_20_DataCollectionGroup_scanParameters.sql','DONE','2018-12-20 17:30:04'),(53,'2019_01_14_Proposal_state.sql','DONE','2019-01-14 12:13:31'),(54,'2019_01_14_ProcessingJobParameter_parameterValue.sql','DONE','2019-01-14 14:00:02'),(57,'2019_01_15_Detector_localName.sql','DONE','2019-01-15 23:01:15'),(58,'2019_02_04_BLSession_unique_index.sql','DONE','2019-02-04 13:52:19'),(59,'2019_03_29_BLSession_archived.sql','DONE','2019-04-03 14:43:08'),(60,'2019_04_03_UserGroup_and_Permission.sql','DONE','2019-04-03 14:51:04'),(61,'2019_04_07_AdminVar_bump_version.sql','DONE','2019-04-07 11:35:06'),(62,'2019_04_08_AdminVar_bump_version.sql','DONE','2019-04-08 15:38:01'),(63,'2019_04_23_AdminVar_bump_version.sql','DONE','2019-04-23 11:13:27'),(64,'2019_04_23_drop_v_run_view.sql','DONE','2019-04-23 11:13:35'),(67,'2019_04_23_v_run_additional_runs.sql','DONE','2019-04-23 12:39:47'),(68,'2019_05_28_AdminVar_bump_version.sql','DONE','2019-05-28 13:29:27'),(72,'2019_07_17_BLSample_crystalId_default.sql','DONE','2019-07-17 15:21:59'),(73,'2019_08_15_Sleeve.sql','DONE','2019-08-15 08:34:34'),(74,'2019_08_15_AdminVar_bump_version.sql','DONE','2019-08-15 08:57:37'),(75,'2019_08_28_AdminVar_bump_version.sql','DONE','2019-08-28 13:30:13'),(76,'2019_08_30_AdminVar_bump_version.sql','DONE','2019-08-30 11:58:16'),(77,'2019_10_06_BLSampleImage_fk3.sql','DONE','2019-10-06 16:55:44'),(78,'2019_10_08_DiffractionPlan_experimentKind.sql','DONE','2019-10-08 12:47:10'),(79,'2019_11_07_AutoProcProgramAttachment_importanceRank.sql','DONE','2019-11-07 16:35:25'),(80,'2019_11_07_AdminVar_bump_version.sql','DONE','2019-11-07 16:45:44'),(81,'2019_11_08_AdminVar_bump_version.sql','DONE','2019-11-08 16:09:52'),(82,'2019_11_26_v_run_idx1.sql','DONE','2019-11-26 15:00:21'),(83,'2019_12_02_AdminVar_bump_version.sql','DONE','2019-12-02 11:29:05'),(84,'2019_12_02_AdminVar_bump_version_v2.sql','DONE','2019-12-02 18:14:11'),(85,'2020_01_03_BLSampleImage_tables.sql','DONE','2020-01-03 16:05:45'),(86,'2020_01_06_AdminVar_bump_version.sql','DONE','2020-01-06 11:45:02'),(87,'2020_01_07_AdminVar_bump_version.sql','DONE','2020-01-07 09:45:25'),(88,'2020_01_07_AdminVar_bump_version_v2.sql','DONE','2020-01-07 10:24:54'),(89,'2020_01_07_AdminVar_bump_version_v3.sql','DONE','2020-01-07 11:16:09'),(90,'2020_01_20_AdminVar_bump_version.sql','DONE','2020-01-20 13:40:52'),(91,'2020_01_20_AdminVar_bump_version_v2.sql','DONE','2020-01-20 16:27:37'),(92,'2020_02_13_SpaceGroup_data.sql','DONE','2020-02-13 16:52:53'),(93,'2020_01_21_DiffractionPlan_experimentKind.sql','DONE','2020-02-13 17:13:17'),(94,'2020_02_21_ProposalHasPerson_role_enum.sql','DONE','2020-02-21 14:36:10'),(95,'2020_02_21_Session_has_Person_role_enum.sql','DONE','2020-02-21 14:36:17'),(96,'2020_02_27_Container_scLocationUpdated.sql','DONE','2020-02-27 13:43:51'),(97,'2020_03_09_Reprocessing_drop_tables.sql','DONE','2020-03-09 11:05:09'),(98,'2020_03_24_ProcessingPipeline_tables.sql','DONE','2020-03-26 16:37:29'),(99,'2020_03_25_ProcessingPipeline_ren_col.sql','DONE','2020-03-26 16:37:34'),(100,'2020_03_27_AdminVar_bump_version.sql','DONE','2020-03-27 08:51:52'),(101,'2020_03_27_AdminVar_bump_version_v2.sql','DONE','2020-03-27 15:07:56'),(102,'2020_04_06_alterProtein.sql','DONE','2020-04-06 13:40:18'),(103,'2020_04_27_BLSampleImageAutoScoreSchema_insert_CHIMP.sql','DONE','2020-04-27 14:37:41'),(104,'2020_05_21_BLSampleImageAutoScoreClass_insert_CHIMP.sql','DONE','2020-05-21 17:52:54'),(105,'2020_06_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-06-01 10:29:19'),(106,'2020_06_01_Protein_new_columns.sql','DONE','2020-06-01 10:29:32'),(107,'2020_06_01_AdminVar_bump_version.sql','DONE','2020-06-01 10:46:11'),(108,'2020_06_08_Shipping_comments.sql','DONE','2020-06-08 16:44:26'),(109,'2020_06_10_DiffractionPlan_experimentKind.sql','DONE','2020-06-10 14:35:18'),(110,'2020_06_15_Shipping_comments.sql','DONE','2020-06-15 14:01:25'),(111,'2020_06_24_BLSampleGroup_name.sql','DONE','2020-06-24 10:56:25'),(112,'2020_06_24_DiffractionPlan_userPath.sql','DONE','2020-06-24 10:56:30'),(113,'2020_07_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-07-01 13:51:49'),(114,'2020_07_06_DewarRegistry_to_DewarRegistry_has_Proposal_data.sql','DONE','2020-07-06 10:59:22'),(115,'2020_07_13_AdminVar_bump_version.sql','DONE','2020-07-13 18:14:39'),(116,'2020_08_03_AdminVar_bump_version.sql','DONE','2020-08-03 15:19:36'),(117,'2020_09_02_AutoProcScalingStatistics_new_index.sql','DONE','2020-09-02 17:02:33'),(118,'2020_09_08_DewarRegistry_modify_fks.sql','DONE','2020-09-08 15:26:14'),(119,'2020_08_28_ComponentSubType_changes.sql','DONE','2020-10-14 18:15:55'),(120,'2020_08_28_ConcentrationType_changes.sql','DONE','2020-10-14 18:15:55'),(121,'2020_08_28_Dewar_type.sql','DONE','2020-10-14 18:15:55'),(122,'2020_08_28_DiffractionPlan_new_temperature_cols.sql','DONE','2020-10-14 18:15:55'),(123,'2020_08_28_ExperimentType.sql','DONE','2020-10-14 18:15:55'),(124,'2020_08_28_PurificationColumn.sql','DONE','2020-10-14 18:15:55'),(125,'2020_08_29_BLSampleType.sql','DONE','2020-10-14 18:15:55'),(126,'2020_08_29_Protein_isotropy.sql','DONE','2020-10-14 18:15:55'),(127,'2020_10_16_AdminVar_bump_version.sql','DONE','2020-10-16 22:05:36'),(128,'2020_10_19_AdminVar_bump_version.sql','DONE','2020-10-20 04:21:23'),(129,'2020_10_22_GridInfo_dcId.sql','DONE','2020-11-09 13:57:27'),(130,'2020_11_09_Phasing_method_enum.sql','DONE','2020-11-09 13:57:27'),(133,'2020_11_09_AdminVar_bump_version.sql','DONE','2020-11-09 22:26:13'),(134,'2020_11_10_SpaceGroup_update.sql','DONE','2020-11-20 17:49:46'),(135,'2020_11_13_Dewar_facilityCode.sql','DONE','2020-11-20 17:49:46'),(136,'2020_11_20_AdminVar_bump_version.sql','DONE','2020-11-20 17:49:46'),(137,'2020_12_01_AdminVar_bump_version.sql','DONE','2020-12-01 12:21:43'); +INSERT INTO `SchemaStatus` (`schemaStatusId`, `scriptName`, `schemaStatus`, `recordTimeStamp`) VALUES (6,'20180213_BLSample_subLocation.sql','DONE','2018-02-13 13:27:19'),(12,'20180213_DataCollectionFileAttachment_fileType.sql','DONE','2018-02-13 15:12:54'),(16,'20180303_v_run_to_table.sql','DONE','2018-07-25 15:11:18'),(19,'20180328_ImageQualityIndicators_alter_table.sql','DONE','2018-07-25 15:11:18'),(22,'20180410_BeamLineSetup_alter.sql','DONE','2018-07-25 15:11:18'),(25,'20180413_BeamLineSetup_and_Detector_alter.sql','DONE','2018-07-25 15:11:18'),(28,'20180501_DataCollectionGroup_experimentType_enum.sql','DONE','2018-07-25 15:11:18'),(31,'20180531_ScreeningOutput_alignmentSuccess.sql','DONE','2018-07-25 15:11:18'),(34,'20180629_DataCollection_imageContainerSubPath.sql','DONE','2018-07-25 15:11:18'),(35,'20180913_BeamCalendar.sql','DONE','2018-09-19 09:52:45'),(36,'2018_09_19_DataCollection_imageDirectory_comment.sql','DONE','2018-09-19 12:38:01'),(37,'2018_09_27_increase_schema_version.sql','DONE','2018-09-27 13:17:15'),(38,'2018_11_01_XrayCenteringResult.sql','DONE','2018-11-01 13:36:53'),(39,'2018_11_01_AutoProcProgram_dataCollectionId.sql','DONE','2018-11-01 15:10:38'),(40,'2018_11_01_AutoProcProgramMessage.sql','DONE','2018-11-01 15:28:17'),(44,'2018_11_01_DiffractionPlan_centeringMethod.sql','DONE','2018-11-01 22:51:36'),(45,'2018_11_02_DataCollectionGroup_experimentType_enum.sql','DONE','2018-11-02 11:54:15'),(47,'2018_11_05_spelling_of_centring.sql','DONE','2018-11-05 15:31:38'),(48,'2018_11_09_AutoProcProgram_update_processing_program.sql','DONE','2018-11-09 16:38:34'),(49,'2018_11_14_AutoProcProgramMessage_autoinc.sql','DONE','2018-11-14 10:15:27'),(50,'2018_11_22_AutoProcProgram_processingStatus_update.sql','DONE','2018-11-22 16:11:15'),(51,'2018_12_04_EnergyScan_and_XFEFluorescenceSpectrum_add_axisPosition.sql','DONE','2018-12-04 14:13:23'),(52,'2018_12_20_DataCollectionGroup_scanParameters.sql','DONE','2018-12-20 17:30:04'),(53,'2019_01_14_Proposal_state.sql','DONE','2019-01-14 12:13:31'),(54,'2019_01_14_ProcessingJobParameter_parameterValue.sql','DONE','2019-01-14 14:00:02'),(57,'2019_01_15_Detector_localName.sql','DONE','2019-01-15 23:01:15'),(58,'2019_02_04_BLSession_unique_index.sql','DONE','2019-02-04 13:52:19'),(59,'2019_03_29_BLSession_archived.sql','DONE','2019-04-03 14:43:08'),(60,'2019_04_03_UserGroup_and_Permission.sql','DONE','2019-04-03 14:51:04'),(61,'2019_04_07_AdminVar_bump_version.sql','DONE','2019-04-07 11:35:06'),(62,'2019_04_08_AdminVar_bump_version.sql','DONE','2019-04-08 15:38:01'),(63,'2019_04_23_AdminVar_bump_version.sql','DONE','2019-04-23 11:13:27'),(64,'2019_04_23_drop_v_run_view.sql','DONE','2019-04-23 11:13:35'),(67,'2019_04_23_v_run_additional_runs.sql','DONE','2019-04-23 12:39:47'),(68,'2019_05_28_AdminVar_bump_version.sql','DONE','2019-05-28 13:29:27'),(72,'2019_07_17_BLSample_crystalId_default.sql','DONE','2019-07-17 15:21:59'),(73,'2019_08_15_Sleeve.sql','DONE','2019-08-15 08:34:34'),(74,'2019_08_15_AdminVar_bump_version.sql','DONE','2019-08-15 08:57:37'),(75,'2019_08_28_AdminVar_bump_version.sql','DONE','2019-08-28 13:30:13'),(76,'2019_08_30_AdminVar_bump_version.sql','DONE','2019-08-30 11:58:16'),(77,'2019_10_06_BLSampleImage_fk3.sql','DONE','2019-10-06 16:55:44'),(78,'2019_10_08_DiffractionPlan_experimentKind.sql','DONE','2019-10-08 12:47:10'),(79,'2019_11_07_AutoProcProgramAttachment_importanceRank.sql','DONE','2019-11-07 16:35:25'),(80,'2019_11_07_AdminVar_bump_version.sql','DONE','2019-11-07 16:45:44'),(81,'2019_11_08_AdminVar_bump_version.sql','DONE','2019-11-08 16:09:52'),(82,'2019_11_26_v_run_idx1.sql','DONE','2019-11-26 15:00:21'),(83,'2019_12_02_AdminVar_bump_version.sql','DONE','2019-12-02 11:29:05'),(84,'2019_12_02_AdminVar_bump_version_v2.sql','DONE','2019-12-02 18:14:11'),(85,'2020_01_03_BLSampleImage_tables.sql','DONE','2020-01-03 16:05:45'),(86,'2020_01_06_AdminVar_bump_version.sql','DONE','2020-01-06 11:45:02'),(87,'2020_01_07_AdminVar_bump_version.sql','DONE','2020-01-07 09:45:25'),(88,'2020_01_07_AdminVar_bump_version_v2.sql','DONE','2020-01-07 10:24:54'),(89,'2020_01_07_AdminVar_bump_version_v3.sql','DONE','2020-01-07 11:16:09'),(90,'2020_01_20_AdminVar_bump_version.sql','DONE','2020-01-20 13:40:52'),(91,'2020_01_20_AdminVar_bump_version_v2.sql','DONE','2020-01-20 16:27:37'),(92,'2020_02_13_SpaceGroup_data.sql','DONE','2020-02-13 16:52:53'),(93,'2020_01_21_DiffractionPlan_experimentKind.sql','DONE','2020-02-13 17:13:17'),(94,'2020_02_21_ProposalHasPerson_role_enum.sql','DONE','2020-02-21 14:36:10'),(95,'2020_02_21_Session_has_Person_role_enum.sql','DONE','2020-02-21 14:36:17'),(96,'2020_02_27_Container_scLocationUpdated.sql','DONE','2020-02-27 13:43:51'),(97,'2020_03_09_Reprocessing_drop_tables.sql','DONE','2020-03-09 11:05:09'),(98,'2020_03_24_ProcessingPipeline_tables.sql','DONE','2020-03-26 16:37:29'),(99,'2020_03_25_ProcessingPipeline_ren_col.sql','DONE','2020-03-26 16:37:34'),(100,'2020_03_27_AdminVar_bump_version.sql','DONE','2020-03-27 08:51:52'),(101,'2020_03_27_AdminVar_bump_version_v2.sql','DONE','2020-03-27 15:07:56'),(102,'2020_04_06_alterProtein.sql','DONE','2020-04-06 13:40:18'),(103,'2020_04_27_BLSampleImageAutoScoreSchema_insert_CHIMP.sql','DONE','2020-04-27 14:37:41'),(104,'2020_05_21_BLSampleImageAutoScoreClass_insert_CHIMP.sql','DONE','2020-05-21 17:52:54'),(105,'2020_06_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-06-01 10:29:19'),(106,'2020_06_01_Protein_new_columns.sql','DONE','2020-06-01 10:29:32'),(107,'2020_06_01_AdminVar_bump_version.sql','DONE','2020-06-01 10:46:11'),(108,'2020_06_08_Shipping_comments.sql','DONE','2020-06-08 16:44:26'),(109,'2020_06_10_DiffractionPlan_experimentKind.sql','DONE','2020-06-10 14:35:18'),(110,'2020_06_15_Shipping_comments.sql','DONE','2020-06-15 14:01:25'),(111,'2020_06_24_BLSampleGroup_name.sql','DONE','2020-06-24 10:56:25'),(112,'2020_06_24_DiffractionPlan_userPath.sql','DONE','2020-06-24 10:56:30'),(113,'2020_07_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-07-01 13:51:49'),(114,'2020_07_06_DewarRegistry_to_DewarRegistry_has_Proposal_data.sql','DONE','2020-07-06 10:59:22'),(115,'2020_07_13_AdminVar_bump_version.sql','DONE','2020-07-13 18:14:39'),(116,'2020_08_03_AdminVar_bump_version.sql','DONE','2020-08-03 15:19:36'),(117,'2020_09_02_AutoProcScalingStatistics_new_index.sql','DONE','2020-09-02 17:02:33'),(118,'2020_09_08_DewarRegistry_modify_fks.sql','DONE','2020-09-08 15:26:14'),(119,'2020_08_28_ComponentSubType_changes.sql','DONE','2020-10-14 18:15:55'),(120,'2020_08_28_ConcentrationType_changes.sql','DONE','2020-10-14 18:15:55'),(121,'2020_08_28_Dewar_type.sql','DONE','2020-10-14 18:15:55'),(122,'2020_08_28_DiffractionPlan_new_temperature_cols.sql','DONE','2020-10-14 18:15:55'),(123,'2020_08_28_ExperimentType.sql','DONE','2020-10-14 18:15:55'),(124,'2020_08_28_PurificationColumn.sql','DONE','2020-10-14 18:15:55'),(125,'2020_08_29_BLSampleType.sql','DONE','2020-10-14 18:15:55'),(126,'2020_08_29_Protein_isotropy.sql','DONE','2020-10-14 18:15:55'),(127,'2020_10_16_AdminVar_bump_version.sql','DONE','2020-10-16 22:05:36'),(128,'2020_10_19_AdminVar_bump_version.sql','DONE','2020-10-20 04:21:23'),(129,'2020_10_22_GridInfo_dcId.sql','DONE','2020-11-09 13:57:27'),(130,'2020_11_09_Phasing_method_enum.sql','DONE','2020-11-09 13:57:27'),(133,'2020_11_09_AdminVar_bump_version.sql','DONE','2020-11-09 22:26:13'),(134,'2020_11_10_SpaceGroup_update.sql','DONE','2020-11-20 17:49:46'),(135,'2020_11_13_Dewar_facilityCode.sql','DONE','2020-11-20 17:49:46'),(136,'2020_11_20_AdminVar_bump_version.sql','DONE','2020-11-20 17:49:46'),(137,'2020_12_01_AdminVar_bump_version.sql','DONE','2020-12-01 12:21:43'),(138,'2020_12_04_Container_experimentTypeId_FK.sql','DONE','2020-12-04 16:34:05'),(139,'2020_12_04_AdminVar_bump_version.sql','DONE','2020-12-04 16:40:14'); /*!40000 ALTER TABLE `SchemaStatus` ENABLE KEYS */; -- @@ -215,4 +215,4 @@ INSERT INTO `PurificationColumn` (`purificationColumnId`, `name`, `active`) VALU /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-12-01 12:22:40 +-- Dump completed on 2020-12-04 16:40:23 diff --git a/schema/routines.sql b/schema/routines.sql index 84f10b3a..d3b4db5d 100644 --- a/schema/routines.sql +++ b/schema/routines.sql @@ -4464,6 +4464,1268 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_container` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_container`(p_id int unsigned, p_useContainerSession boolean, p_authLogin varchar(45)) + READS SQL DATA + COMMENT 'Returns a single-row result-set with the container for the given ID' +BEGIN + + IF p_id IS NOT NULL THEN + + IF p_useContainerSession = True THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.containerId = p_id AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.containerId = p_id; + + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.containerId = p_id AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.containerId = p_id; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_id can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_containers_for_session` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_containers_for_session`( + p_proposalCode varchar(45), + p_proposalNumber varchar(45), + p_sessionNumber int unsigned, + p_status varchar(45), + p_authLogin varchar(45) +) + READS SQL DATA + COMMENT 'Returns a multi-row result-set with the containers for the given session defined by proposal code, proposal number and session number' +BEGIN + + IF p_proposalCode IS NOT NULL AND p_proposalNumber IS NOT NULL THEN + + IF p_sessionNumber IS NOT NULL THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE p.proposalCode = p_proposalCode AND p.proposalNumber = p_proposalNumber AND bs.visit_number = p_sessionNumber AND c.containerStatus = p_status AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE p.proposalCode = p_proposalCode AND p.proposalNumber = p_proposalNumber AND bs.visit_number = p_sessionNumber AND c.containerStatus = p_status; + + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE p.proposalCode = p_proposalCode AND p.proposalNumber = p_proposalNumber AND c.containerStatus = p_status AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE p.proposalCode = p_proposalCode AND p.proposalNumber = p_proposalNumber AND c.containerStatus = p_status; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory arguments p_proposalCode and p_proposalNumber can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_container_for_barcode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_container_for_barcode`(p_barcode varchar(45), p_useContainerSession boolean, p_authLogin varchar(45)) + READS SQL DATA + COMMENT 'Returns a single-row result-set with the container for the given barcode' +BEGIN + + IF p_barcode IS NOT NULL THEN + + IF p_useContainerSession = True THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.barcode = p_barcode AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + c.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN BLSession bs ON bs.sessionId = c.sessionId + JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.barcode = p_barcode; + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + JOIN Session_has_Person shp ON shp.sessionId = bs2.sessionId + JOIN Person per on per.personId = shp.personId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.barcode = p_barcode AND per.login = p_authLogin; + + ELSE + + SELECT c.containerId "containerId", + d.dewarId "dewarId", + c.sessionId "sessionId", + p.proposalId "proposalId", + c.ownerId "ownerId", + per2.login "ownerUsername", + c.code "name", + c.containerType "type", + c.barcode "barcode", + c.beamlineLocation "beamline", + c.sampleChangerLocation "location", + c.containerStatus "status", + c.capacity "capacity", + c.storageTemperature "storageTemperature", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber", + + c.comments "comments", + et.name "experimentType" + FROM Container c + JOIN Dewar d ON c.dewarId = d.dewarId + JOIN Shipping s ON s.shippingId = d.shippingId + JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Person per2 ON per2.personId = c.ownerId + LEFT JOIN ExperimentType et ON et.experimentTypeId = c.experimentTypeId + WHERE c.barcode = p_barcode; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_barcode can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_sample` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_sample`(p_id int unsigned, p_useContainerSession boolean, p_authLogin varchar(45)) + READS SQL DATA + COMMENT 'Returns a single-row result-set with the sample for the given ID' +BEGIN + + IF p_id IS NOT NULL THEN + + IF p_useContainerSession = True THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + INNER JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs2.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND bls.blSampleId = p_id; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE bls.blSampleId = p_id; + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + INNER JOIN BLSession bs ON bs.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND bls.blSampleId = p_id; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE bls.blSampleId = p_id; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_id can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_samples_for_container_id` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_samples_for_container_id`(p_containerId int unsigned, p_useContainerSession boolean, p_authLogin varchar(45)) + READS SQL DATA + COMMENT 'Returns a multi-row result-set with the samples for the given container ID' +BEGIN + + IF p_containerId IS NOT NULL THEN + + IF p_useContainerSession = True THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + INNER JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs2.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND bls.containerId = p_containerId; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE bls.containerId = p_containerId; + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + INNER JOIN BLSession bs ON bs.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND bls.containerId = p_containerId; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE bls.containerId = p_containerId; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_containerId can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `retrieve_scm_sample_for_container_barcode_and_location` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `retrieve_scm_sample_for_container_barcode_and_location`(p_barcode varchar(45), p_location varchar(45), p_useContainerSession boolean, p_authLogin varchar(45)) + READS SQL DATA + COMMENT 'Returns a single-row result-set (although can be multi-row if multiple samples per location in a container) with the sample for the given container barcode and sample location.' +BEGIN + + IF p_barcode IS NOT NULL AND p_location IS NOT NULL THEN + + IF p_useContainerSession = True THEN + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + INNER JOIN BLSession bs2 ON bs2.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs2.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND c.barcode = p_barcode AND bls.location = p_location; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + bs.visit_number "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN BLSession bs ON c.sessionId = bs.sessionId + INNER JOIN Proposal p ON p.proposalId = bs.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE c.barcode = p_barcode AND bls.location = p_location; + + END IF; + + ELSE + + IF p_authLogin IS NOT NULL THEN + + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + INNER JOIN BLSession bs ON bs.proposalId = p.proposalId + INNER JOIN Session_has_Person shp ON bs.sessionId = shp.sessionId + INNER JOIN Person pe ON pe.personId = shp.personId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE pe.login = p_authLogin AND c.barcode = p_barcode AND bls.location = p_location; + + ELSE + + SELECT DISTINCT bls.blSampleId "sampleId", + pr.proteinId "materialId", + bls.containerId "containerId", + bls.diffractionPlanId "planId", + c.sessionId "sessionId", + p.proposalId "proposalId", + + bls.name "sampleName", + bls.code "sampleCode", + bls.volume "sampleVolume", + bls.dimension1 "thickness", + bls.comments "sampleComments", + bls.location "sampleLocation", + bls.subLocation "sampleSubLocation", + bls.blSampleStatus "sampleStatus", + + pr.name "materialName", + pr.acronym "materialAcronym", + pr.sequence "materialFormula", + pr.density "materialDensity", + pr.safetyLevel "materialSafetyLevel", + pr.description "materialChemicalDescription", + pr.molecularMass "materialMolecularMass", + compt.name "materialType", + conct.name "materialConcentrationType", + pr.isotropy "materialIsotropy", + + et.name "planExperimentType", + pc.name "planPurificationColumn", + plan.robotPlateTemperature "planRobotPlateTemperature", + plan.exposureTemperature "planExposureTemperature", + plan.transmission "planTransmission", + + p.proposalCode "proposalCode", + p.proposalNumber "proposalNumber", + NULL "sessionNumber" + FROM BLSample bls + INNER JOIN Container c ON c.containerId = bls.containerId + INNER JOIN Dewar d ON d.dewarId = c.dewarId + INNER JOIN Shipping s ON s.shippingId = d.shippingId + INNER JOIN Proposal p ON p.proposalId = s.proposalId + LEFT JOIN Crystal cr ON cr.crystalId = bls.crystalId + LEFT JOIN Protein pr ON pr.proteinId = cr.proteinId + LEFT JOIN ComponentType compt ON compt.componentTypeId = pr.componentTypeId + LEFT JOIN ConcentrationType conct ON conct.concentrationTypeId = pr.concentrationTypeId + LEFT JOIN DiffractionPlan plan ON plan.diffractionPlanId = bls.diffractionPlanId + LEFT JOIN ExperimentType et ON et.experimentTypeId = plan.experimentTypeId AND et.proposalType = 'scm' + LEFT JOIN PurificationColumn pc ON pc.purificationColumnId = plan.purificationColumnId + WHERE c.barcode = p_barcode AND bls.location = p_location; + + END IF; + + END IF; + + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory arguments p_barcode and p_location can not be NULL'; + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `retrieve_sessions_for_beamline_and_run` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8252,7 +9514,7 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-12-01 12:22:39 +-- Dump completed on 2020-12-04 16:35:22 -- MariaDB dump 10.18 Distrib 10.5.8-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: ispyb_build @@ -8298,4 +9560,4 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-12-01 12:22:40 +-- Dump completed on 2020-12-04 16:35:22 diff --git a/schema/tables.sql b/schema/tables.sql index 457b2e7d..d19464b5 100644 --- a/schema/tables.sql +++ b/schema/tables.sql @@ -1323,6 +1323,7 @@ CREATE TABLE `Container` ( `containerRegistryId` int(11) unsigned DEFAULT NULL, `scLocationUpdated` datetime DEFAULT NULL, `priorityPipelineId` int(11) unsigned DEFAULT NULL, + `experimentTypeId` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`containerId`), UNIQUE KEY `Container_UNIndex1` (`barcode`), KEY `Container_FKIndex` (`beamlineLocation`), @@ -1336,6 +1337,8 @@ CREATE TABLE `Container` ( KEY `Container_ibfk8` (`containerRegistryId`), KEY `Container_ibfk6` (`sessionId`), KEY `Container_ibfk9` (`priorityPipelineId`), + KEY `Container_fk_experimentTypeId` (`experimentTypeId`), + CONSTRAINT `Container_fk_experimentTypeId` FOREIGN KEY (`experimentTypeId`) REFERENCES `ExperimentType` (`experimentTypeId`), CONSTRAINT `Container_ibfk2` FOREIGN KEY (`screenId`) REFERENCES `Screen` (`screenId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `Container_ibfk3` FOREIGN KEY (`scheduleId`) REFERENCES `Schedule` (`scheduleId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `Container_ibfk4` FOREIGN KEY (`imagerId`) REFERENCES `Imager` (`imagerId`) ON DELETE NO ACTION ON UPDATE NO ACTION, @@ -5824,4 +5827,4 @@ SET character_set_client = @saved_cs_client; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-11-20 17:50:06 +-- Dump completed on 2020-12-04 16:35:22 diff --git a/schema/updates/2020_12_04_AdminVar_bump_version.sql b/schema/updates/2020_12_04_AdminVar_bump_version.sql new file mode 100644 index 00000000..0fd76572 --- /dev/null +++ b/schema/updates/2020_12_04_AdminVar_bump_version.sql @@ -0,0 +1,5 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_12_04_AdminVar_bump_version.sql', 'ONGOING'); + +UPDATE AdminVar SET `value` = '1.16.0' WHERE `name` = 'schemaVersion'; + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_12_04_AdminVar_bump_version.sql';