Skip to content
Open
Show file tree
Hide file tree
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
18 changes: 8 additions & 10 deletions schemas/ispyb/stored_programs/sp_upsert_dcg_grid.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ CREATE OR REPLACE DEFINER=`ispyb_root`@`%` PROCEDURE `upsert_dcg_grid`(
p_stepsX double,
p_stepsY double,
p_meshAngle double,
p_pixelsPerMicronX float,
p_pixelsPerMicronY float,
p_micronsPerPixelX float,
p_micronsPerPixelY float,
p_snapshotOffsetXPixel float,
p_snapshotOffsetYPixel float,
p_orientation enum('vertical','horizontal'),
Expand All @@ -21,11 +21,11 @@ CREATE OR REPLACE DEFINER=`ispyb_root`@`%` PROCEDURE `upsert_dcg_grid`(
MODIFIES SQL DATA
BEGIN
IF p_dcgId IS NOT NULL THEN
INSERT INTO GridInfo (gridInfoId, dataCollectionGroupId, dx_mm, dy_mm, steps_x, steps_y, meshAngle,
pixelsPerMicronX, pixelsPerMicronY, micronsPerPixelX, micronsPerPixelY,
INSERT INTO GridInfo (gridInfoId, dataCollectionGroupId, dx_mm, dy_mm, steps_x, steps_y, meshAngle,
micronsPerPixelX, micronsPerPixelY,
snapshot_offsetXPixel, snapshot_offsetYPixel, orientation, snaked)
VALUES (p_id, p_dcgId, p_dxInMm, p_dyInMm, p_stepsX, p_stepsY, p_meshAngle,
p_pixelsPerMicronX, p_pixelsPerMicronY, p_pixelsPerMicronX, p_pixelsPerMicronY,
VALUES (p_id, p_dcgId, p_dxInMm, p_dyInMm, p_stepsX, p_stepsY, p_meshAngle,
p_micronsPerPixelX, p_micronsPerPixelY,
p_snapshotOffsetXPixel, p_snapshotOffsetYPixel, p_orientation, p_snaked)
ON DUPLICATE KEY UPDATE
dataCollectionGroupId = IFNULL(p_dcgId, dataCollectionGroupId),
Expand All @@ -34,10 +34,8 @@ BEGIN
steps_x = IFNULL(p_stepsX, steps_x),
steps_y = IFNULL(p_stepsY, steps_y),
meshAngle = IFNULL(p_meshAngle, meshAngle),
pixelsPerMicronX = IFNULL(p_pixelsPerMicronX, pixelsPerMicronX),
pixelsPerMicronY = IFNULL(p_pixelsPerMicronY, pixelsPerMicronY),
micronsPerPixelX = IFNULL(p_pixelsPerMicronX, micronsPerPixelX),
micronsPerPixelY = IFNULL(p_pixelsPerMicronY, micronsPerPixelY),
micronsPerPixelX = IFNULL(p_pixelsPerMicronX, micronsPerPixelX),
micronsPerPixelY = IFNULL(p_pixelsPerMicronY, micronsPerPixelY),
snapshot_offsetXPixel = IFNULL(p_snapshotOffsetXPixel, snapshot_offsetXPixel),
snapshot_offsetYPixel = IFNULL(p_snapshotOffsetYPixel, snapshot_offsetYPixel),
orientation = IFNULL(p_orientation, orientation),
Expand Down
10 changes: 10 additions & 0 deletions schemas/ispyb/updates/2025_03_21_GridInfo_pixelsPerMicron.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2025_03_21_GridInfo_pixelsPerMicron.sql', 'ONGOING');

UPDATE GridInfo SET micronsPerPixelX = pixelsPerMicronX WHERE micronsPerPixelX IS NULL;
UPDATE GridInfo SET micronsPerPixelY = pixelsPerMicronY WHERE micronsPerPixelY IS NULL;

ALTER TABLE GridInfo
DROP COLUMN pixelsPerMicronX,
DROP COLUMN pixelsPerMicronY;

UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2025_03_21_GridInfo_pixelsPerMicron.sql';