Skip to content

Commit 22e9d5b

Browse files
authored
Preparations for release 4.7.0 (#275)
1 parent ba88503 commit 22e9d5b

File tree

4 files changed

+92
-16
lines changed

4 files changed

+92
-16
lines changed

schemas/ispyb/lookups.sql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
1212

1313
/*!40000 ALTER TABLE `AdminVar` DISABLE KEYS */;
14-
INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','4.6.0');
14+
INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','4.7.0');
1515
/*!40000 ALTER TABLE `AdminVar` ENABLE KEYS */;
1616

1717
/*!40000 ALTER TABLE `SchemaStatus` DISABLE KEYS */;
@@ -278,7 +278,16 @@ INSERT INTO `SchemaStatus` (`schemaStatusId`, `scriptName`, `schemaStatus`, `rec
278278
(306,'2025_02_25_AdminVar_bump_version.sql','DONE','2025-02-25 15:51:30'),
279279
(307,'2025_02_27_ExperimentType_atlas.sql','DONE','2025-03-06 11:58:07'),
280280
(308,'2025_03_05_Dewar_dewarRegistryId.sql','DONE','2025-03-06 11:58:07'),
281-
(309,'2025_03_06_AdminVar_bump_version.sql','DONE','2025-03-06 11:58:07');
281+
(309,'2025_03_06_AdminVar_bump_version.sql','DONE','2025-03-06 11:58:07'),
282+
(310,'2025_03_20_ParticleClassification_angularEfficiency_suggestedTilt.sql','DONE','2025-05-09 15:21:06'),
283+
(311,'2025_04_11_Position_blSampleId_positionType.sql','DONE','2025-05-09 15:21:06'),
284+
(312,'2025_04_16_labContacts_fk_on_delete_set_null.sql','DONE','2025-05-09 15:21:06'),
285+
(313,'2025_04_29_DewarRegistry_fk_labContactId_on_delete_set_null.sql','DONE','2025-05-09 15:21:06'),
286+
(314,'2025_04_30_Shipping_fk_personId_on_delete_set_null.sql','DONE','2025-05-09 15:21:06'),
287+
(315,'2025_05_01_BLSamplePosition.sql','DONE','2025-05-09 15:21:06'),
288+
(316,'2025_05_01_XrayCentringResult_fk_blSampleId.sql','DONE','2025-05-09 15:21:06'),
289+
(317,'2025_05_02_BLSamplePosition_rename_column.sql','DONE','2025-05-09 15:21:06'),
290+
(318,'2025_05_12_AdminVar_bump_version.sql','DONE','2025-05-09 15:21:06');
282291
/*!40000 ALTER TABLE `SchemaStatus` ENABLE KEYS */;
283292

284293
/*!40000 ALTER TABLE `ComponentType` DISABLE KEYS */;

schemas/ispyb/routines.sql

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7456,30 +7456,61 @@ BEGIN
74567456
DECLARE row_beamlineLocation varchar(20) DEFAULT NULL;
74577457
DECLARE row_sampleChangerLocation varchar(20) DEFAULT NULL;
74587458
DECLARE row_proposalId int(10) unsigned DEFAULT NULL;
7459+
DECLARE row_proposalCode varchar(45) DEFAULT NULL;
7460+
DECLARE row_proposalNumber varchar(45) DEFAULT NULL;
74597461
DECLARE row_queuedCount int(11) unsigned DEFAULT NULL;
7462+
DECLARE row_samples varchar(255) DEFAULT NULL;
7463+
7464+
IF p_beamline IS NULL THEN
7465+
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_beamline is NULL';
7466+
END IF;
74607467

74617468
IF NOT (p_registry_barcode IS NULL) THEN
74627469
START TRANSACTION;
74637470

7464-
SELECT c.containerId, c.containerStatus, c.dewarId, c.beamlineLocation, c.sampleChangerLocation, s.proposalId, count(cq.containerQueueId)
7465-
INTO row_containerId, row_containerStatus, row_dewarId, row_beamlineLocation, row_sampleChangerLocation, row_proposalId, row_queuedCount
7471+
SELECT c.containerId,
7472+
c.containerStatus,
7473+
c.dewarId,
7474+
c.beamlineLocation,
7475+
c.sampleChangerLocation,
7476+
p.proposalId,
7477+
p.proposalCode,
7478+
p.proposalNumber,
7479+
count(cq.containerQueueId)
7480+
INTO row_containerId,
7481+
row_containerStatus,
7482+
row_dewarId,
7483+
row_beamlineLocation,
7484+
row_sampleChangerLocation,
7485+
row_proposalId,
7486+
row_proposalCode,
7487+
row_proposalNumber,
7488+
row_queuedCount
74667489
FROM Container c
74677490
INNER JOIN ContainerRegistry cr ON c.containerRegistryId = cr.containerRegistryId
74687491
INNER JOIN Dewar d ON d.dewarId = c.dewarId
74697492
INNER JOIN Shipping s ON s.shippingId = d.shippingId
7493+
INNER JOIN Proposal p ON p.proposalId = s.proposalId
74707494
LEFT OUTER JOIN ContainerQueue cq ON cq.containerId = c.containerId
74717495
WHERE cr.barcode = p_registry_barcode
7472-
GROUP BY c.containerId, c.containerStatus, c.dewarId, c.beamlineLocation, c.sampleChangerLocation, s.proposalId
7496+
GROUP BY c.containerId,
7497+
c.containerStatus,
7498+
c.dewarId,
7499+
c.beamlineLocation,
7500+
c.sampleChangerLocation,
7501+
p.proposalId,
7502+
p.proposalCode,
7503+
p.proposalNumber
74737504
ORDER BY c.containerId DESC
74747505
LIMIT 1;
74757506

74767507
SELECT row_containerStatus INTO currentContainerStatus;
74777508

7478-
7509+
74797510
IF NOT row_containerId IS NULL THEN
74807511
IF (NOT row_containerStatus <=> 'processing') OR (row_beamlineLocation = p_beamline AND row_sampleChangerLocation = p_position) THEN
74817512

7482-
7513+
74837514
UPDATE Container c
74847515
INNER JOIN Dewar d ON d.dewarId = c.dewarId
74857516
INNER JOIN Shipping s ON s.shippingId = d.shippingId
@@ -7496,8 +7527,8 @@ BEGIN
74967527
SELECT IF(row_containerStatus<=>'processing', 'at facility', 'processing') INTO currentContainerStatus;
74977528

74987529
IF NOT row_containerStatus <=> 'processing' THEN
7499-
7500-
7530+
7531+
75017532
UPDATE Container c
75027533
INNER JOIN Dewar d ON d.dewarId = c.dewarId
75037534
INNER JOIN Shipping s ON s.shippingId = d.shippingId
@@ -7506,12 +7537,12 @@ BEGIN
75067537
WHERE s.proposalId = row_proposalId AND c.beamlineLocation = p_beamline AND
75077538
c.sampleChangerLocation = p_position AND c.containerId <> row_containerId;
75087539

7509-
7540+
75107541
INSERT INTO DewarTransportHistory (dewarId, dewarStatus, storageLocation, arrivalDate)
75117542
VALUES (row_dewarId, 'processing', p_beamline, NOW());
75127543
END IF;
75137544

7514-
7545+
75157546
INSERT INTO ContainerHistory (containerId, location, status, beamlineName, currentDewarId)
75167547
SELECT row_containerId, p_position, IF(row_containerStatus<=>'processing', 'at facility', 'processing'), p_beamline, currentDewarId
75177548
FROM Container
@@ -7525,9 +7556,19 @@ BEGIN
75257556
ELSE
75267557
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_registry_barcode is NULL';
75277558
END IF;
7559+
7560+
SELECT group_concat(location ORDER BY cast(location AS integer) SEPARATOR ',')
7561+
INTO row_samples
7562+
FROM BLSample
7563+
WHERE containerId = row_containerId
7564+
GROUP BY containerId;
7565+
75287566
SELECT row_containerId as "containerId",
75297567
currentContainerStatus as "containerStatus",
7530-
row_queuedCount as "queuedCount";
7568+
row_proposalCode as "proposalCode",
7569+
row_proposalNumber as "proposalNumber",
7570+
row_queuedCount as "queuedCount",
7571+
row_samples as "samples";
75317572
END ;;
75327573
DELIMITER ;
75337574
/*!50003 SET sql_mode = @saved_sql_mode */ ;

schemas/ispyb/tables.sql

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,22 @@ CREATE TABLE `BLSampleImage_has_Positioner` (
605605
CONSTRAINT `BLSampleImageHasPositioner_ibfk2` FOREIGN KEY (`positionerId`) REFERENCES `Positioner` (`positionerId`)
606606
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Allows a BLSampleImage to store motor positions along with the image';
607607
/*!40101 SET character_set_client = @saved_cs_client */;
608+
DROP TABLE IF EXISTS `BLSamplePosition`;
609+
/*!40101 SET @saved_cs_client = @@character_set_client */;
610+
/*!40101 SET character_set_client = utf8mb4 */;
611+
CREATE TABLE `BLSamplePosition` (
612+
`blSamplePositionId` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key (auto-incremented)',
613+
`blSampleId` int(11) unsigned NOT NULL COMMENT 'FK, references parent sample',
614+
`posX` double DEFAULT NULL,
615+
`posY` double DEFAULT NULL,
616+
`posZ` double DEFAULT NULL,
617+
`recordTimeStamp` datetime DEFAULT NULL COMMENT 'Creation or last update date/time',
618+
`positionType` enum('dispensing') DEFAULT NULL COMMENT 'Type of marked position (e.g.: dispensing location)',
619+
PRIMARY KEY (`blSamplePositionId`),
620+
KEY `BLSamplePosition_fk_blSampleId` (`blSampleId`),
621+
CONSTRAINT `BLSamplePosition_fk_blSampleId` FOREIGN KEY (`blSampleId`) REFERENCES `BLSample` (`blSampleId`)
622+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
623+
/*!40101 SET character_set_client = @saved_cs_client */;
608624
DROP TABLE IF EXISTS `BLSampleType`;
609625
/*!40101 SET @saved_cs_client = @@character_set_client */;
610626
/*!40101 SET character_set_client = utf8mb4 */;
@@ -1687,7 +1703,7 @@ CREATE TABLE `DewarRegistry_has_Proposal` (
16871703
CONSTRAINT `DewarRegistry_has_Proposal_ibfk1` FOREIGN KEY (`dewarRegistryId`) REFERENCES `DewarRegistry` (`dewarRegistryId`),
16881704
CONSTRAINT `DewarRegistry_has_Proposal_ibfk2` FOREIGN KEY (`proposalId`) REFERENCES `Proposal` (`proposalId`),
16891705
CONSTRAINT `DewarRegistry_has_Proposal_ibfk3` FOREIGN KEY (`personId`) REFERENCES `Person` (`personId`),
1690-
CONSTRAINT `DewarRegistry_has_Proposal_ibfk4` FOREIGN KEY (`labContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE NO ACTION ON UPDATE CASCADE
1706+
CONSTRAINT `DewarRegistry_has_Proposal_ibfk4` FOREIGN KEY (`labContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE SET NULL ON UPDATE CASCADE
16911707
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
16921708
/*!40101 SET character_set_client = @saved_cs_client */;
16931709
DROP TABLE IF EXISTS `DewarReport`;
@@ -2396,6 +2412,8 @@ CREATE TABLE `ParticleClassification` (
23962412
`bFactorFitIntercept` float DEFAULT NULL COMMENT 'Intercept of quadratic fit to refinement resolution against the logarithm of the number of particles',
23972413
`bFactorFitLinear` float DEFAULT NULL COMMENT 'Linear coefficient of quadratic fit to refinement resolution against the logarithm of the number of particles, equal to half of the B factor',
23982414
`bFactorFitQuadratic` float DEFAULT NULL COMMENT 'Quadratic coefficient of quadratic fit to refinement resolution against the logarithm of the number of particles',
2415+
`angularEfficiency` double DEFAULT NULL COMMENT 'Variation in resolution across different angles, 1-2sig/mean',
2416+
`suggestedTilt` double DEFAULT NULL COMMENT 'Suggested stage tilt angle to improve angular efficiency. Unit: degrees',
23992417
PRIMARY KEY (`particleClassificationId`),
24002418
KEY `ParticleClassification_fk_particleClassificationGroupId` (`particleClassificationGroupId`),
24012419
CONSTRAINT `ParticleClassification_fk_particleClassificationGroupId` FOREIGN KEY (`particleClassificationGroupId`) REFERENCES `ParticleClassificationGroup` (`particleClassificationGroupId`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -3456,9 +3474,9 @@ CREATE TABLE `Shipping` (
34563474
KEY `Shipping_FKIndexStatus` (`shippingStatus`),
34573475
KEY `Shipping_ibfk_4` (`deliveryAgent_flightCodePersonId`),
34583476
CONSTRAINT `Shipping_ibfk_1` FOREIGN KEY (`proposalId`) REFERENCES `Proposal` (`proposalId`) ON DELETE CASCADE ON UPDATE CASCADE,
3459-
CONSTRAINT `Shipping_ibfk_2` FOREIGN KEY (`sendingLabContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE CASCADE ON UPDATE CASCADE,
3460-
CONSTRAINT `Shipping_ibfk_3` FOREIGN KEY (`returnLabContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE CASCADE ON UPDATE CASCADE,
3461-
CONSTRAINT `Shipping_ibfk_4` FOREIGN KEY (`deliveryAgent_flightCodePersonId`) REFERENCES `Person` (`personId`)
3477+
CONSTRAINT `Shipping_ibfk_2` FOREIGN KEY (`sendingLabContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE SET NULL ON UPDATE CASCADE,
3478+
CONSTRAINT `Shipping_ibfk_3` FOREIGN KEY (`returnLabContactId`) REFERENCES `LabContact` (`labContactId`) ON DELETE SET NULL ON UPDATE CASCADE,
3479+
CONSTRAINT `Shipping_ibfk_4` FOREIGN KEY (`deliveryAgent_flightCodePersonId`) REFERENCES `Person` (`personId`) ON DELETE SET NULL ON UPDATE CASCADE
34623480
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
34633481
/*!40101 SET character_set_client = @saved_cs_client */;
34643482
DROP TABLE IF EXISTS `ShippingHasSession`;
@@ -3762,8 +3780,11 @@ CREATE TABLE `XrayCentringResult` (
37623780
`boundingBoxMaxZ` float DEFAULT NULL COMMENT 'Maximum z-coordinate of the bounding box containing the crystal (in voxels)',
37633781
`status` enum('success','failure','pending') DEFAULT NULL COMMENT 'to be removed',
37643782
`gridInfoId` int(11) unsigned DEFAULT NULL COMMENT 'to be removed',
3783+
`blSampleId` int(11) unsigned DEFAULT NULL COMMENT 'The BLSample attributed for this x-ray centring result, i.e. the actual sample even for multi-pins',
37653784
PRIMARY KEY (`xrayCentringResultId`),
37663785
KEY `xrayCentringId` (`xrayCentringId`),
3786+
KEY `XrayCentringResult_fk_blSampleId` (`blSampleId`),
3787+
CONSTRAINT `XrayCentringResult_fk_blSampleId` FOREIGN KEY (`blSampleId`) REFERENCES `BLSample` (`blSampleId`) ON DELETE SET NULL ON UPDATE CASCADE,
37673788
CONSTRAINT `XrayCentringResult_ibfk_1` FOREIGN KEY (`xrayCentringId`) REFERENCES `XrayCentring` (`xrayCentringId`) ON DELETE CASCADE ON UPDATE CASCADE
37683789
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Xray Centring result.';
37693790
/*!40101 SET character_set_client = @saved_cs_client */;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2025_05_12_AdminVar_bump_version.sql', 'ONGOING');
2+
3+
UPDATE AdminVar SET `value` = '4.7.0' WHERE `name` = 'schemaVersion';
4+
5+
UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2025_05_12_AdminVar_bump_version.sql';

0 commit comments

Comments
 (0)