Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detector ROIs #113

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions schemas/ispyb/updates/2022_06_28_detector_rois.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2022_06_28_detector_rois.sql', 'ONGOING');

DROP TABLE IF EXISTS `DetectorROI`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `DetectorROI` (
`detectorROIId` int(11) unsigned NOT NULL AUTO_INCREMENT,
`detectorId` int(11) NOT NULL,
`blSampleId` int(10) unsigned NOT NULL,
`type` varchar(50) NOT NULL COMMENT 'The ROI type rectangle, arc, q range, etc',
`name` varchar(50) NOT NULL COMMENT 'A short name for this ROI',
`blTimestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`definition` text NOT NULL COMMENT 'The ROI definition in json format' CHECK (json_valid(`definition`)),
PRIMARY KEY (`detectorROIId`),
KEY `detectorROI_fk1` (`detectorId`),
KEY `detectorROI_fk2` (`blSampleId`),
CONSTRAINT `detectorROI_fk1` FOREIGN KEY (`detectorId`) REFERENCES `Detector` (`detectorId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `detectorROI_fk2` FOREIGN KEY (`blSampleId`) REFERENCES `BLSample` (`blSampleId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COMMENT='Store an ROI for a 2d detector against a particular sample';
/*!40101 SET character_set_client = @saved_cs_client */;

ALTER TABLE `XRFFluorescenceMapping`
CHANGE `xrfFluorescenceMappingROIId` `xrfFluorescenceMappingROIId` int(11) unsigned NULL,
ADD `detectorROIId` int(11) unsigned NULL,
ADD CONSTRAINT `XRFFluorescenceMapping_ibfk4`
FOREIGN KEY (`detectorROIId`)
REFERENCES `DetectorROI`(`detectorROIId`);

UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2022_06_28_detector_rois.sql';