From bba503566c201d4fd12b30684c3c8663f1d367c4 Mon Sep 17 00:00:00 2001 From: MarvinDo Date: Fri, 31 May 2024 15:26:16 +0200 Subject: [PATCH] update update database --- .../update_database/update_database_9.sql | 92 ++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/resources/update_database/update_database_9.sql b/resources/update_database/update_database_9.sql index 2fd95f62..acfe92c4 100644 --- a/resources/update_database/update_database_9.sql +++ b/resources/update_database/update_database_9.sql @@ -1,48 +1,51 @@ -ALTER TABLE `HerediVar`.`annotation_queue` -CHANGE COLUMN `status` `status` ENUM('pending', 'success', 'error', 'retry', 'aborted', 'progress') NOT NULL DEFAULT 'pending' ; +-- ALTER TABLE `HerediVar`.`annotation_queue` +-- CHANGE COLUMN `status` `status` ENUM('pending', 'success', 'error', 'retry', 'aborted', 'progress') NOT NULL DEFAULT 'pending' ; +-- +-- UPDATE HerediVar.annotation_type SET is_deleted = 1 WHERE title = "maxentscan_ref" OR title = "maxentscan_alt"; +-- +-- ALTER TABLE `HerediVar`.`consensus_classification` +-- ADD COLUMN `needs_heredicare_upload` TINYINT(1) NOT NULL DEFAULT 1 AFTER `scheme_class`; +-- UPDATE `consensus_classification` SET `needs_heredicare_upload` = `is_recent` WHERE `id`=`id`; +-- +-- +-- +-- CREATE TABLE `HerediVar`.`upload_queue` ( +-- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, +-- `user_id` INT NOT NULL, +-- `requested_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), +-- `status` ENUM('pending', 'progress', 'success', 'error', 'retry') NOT NULL DEFAULT 'pending', +-- `finished_at` DATETIME NULL, +-- `message` TEXT NULL, +-- `celery_task_id` VARCHAR(45) NULL, +-- PRIMARY KEY (`id`)); +-- +-- CREATE TABLE `HerediVar`.`upload_variant_queue` ( +-- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, +-- `upload_queue_id` INT UNSIGNED NOT NULL, +-- `status` ENUM('pending', 'success', 'error', 'progress', 'retry') NOT NULL DEFAULT 'pending', +-- `requested_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), +-- `finished_at` DATETIME NULL, +-- `message` TEXT NULL, +-- `celery_task_id` VARCHAR(45) NULL, +-- `vid` TEXT NOT NULL, +-- `submission_id` INT NOT NULL, +-- PRIMARY KEY (`id`)); +-- +-- ALTER TABLE `HerediVar`.`upload_variant_queue` +-- CHANGE COLUMN `upload_queue_id` `upload_queue_id` INT(10) UNSIGNED NULL ; +-- ALTER TABLE `HerediVar`.`upload_variant_queue` +-- ADD COLUMN `variant_id` INT UNSIGNED NOT NULL AFTER `vid`; +-- ALTER TABLE `HerediVar`.`upload_variant_queue` +-- ADD COLUMN `user_id` INT UNSIGNED NOT NULL AFTER `submission_id`; +-- ALTER TABLE `HerediVar`.`upload_variant_queue` +-- CHANGE COLUMN `submission_id` `submission_id` INT(11) NULL ; +-- +-- +-- ALTER TABLE `HerediVar`.`upload_queue` +-- RENAME TO `HerediVar`.`publish_queue` ; -UPDATE HerediVar.annotation_type SET is_deleted = 1 WHERE title = "maxentscan_ref" OR title = "maxentscan_alt"; - -ALTER TABLE `HerediVar`.`consensus_classification` -ADD COLUMN `needs_heredicare_upload` TINYINT(1) NOT NULL DEFAULT 1 AFTER `scheme_class`; -UPDATE `consensus_classification` SET `needs_heredicare_upload` = `is_recent` WHERE `id`=`id`; - - - -CREATE TABLE `HerediVar`.`upload_queue` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `user_id` INT NOT NULL, - `requested_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), - `status` ENUM('pending', 'progress', 'success', 'error', 'retry') NOT NULL DEFAULT 'pending', - `finished_at` DATETIME NULL, - `message` TEXT NULL, - `celery_task_id` VARCHAR(45) NULL, - PRIMARY KEY (`id`)); - -CREATE TABLE `HerediVar`.`upload_variant_queue` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `upload_queue_id` INT UNSIGNED NOT NULL, - `status` ENUM('pending', 'success', 'error', 'progress', 'retry') NOT NULL DEFAULT 'pending', - `requested_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), - `finished_at` DATETIME NULL, - `message` TEXT NULL, - `celery_task_id` VARCHAR(45) NULL, - `vid` TEXT NOT NULL, - `submission_id` INT NOT NULL, - PRIMARY KEY (`id`)); - -ALTER TABLE `HerediVar`.`upload_variant_queue` -CHANGE COLUMN `upload_queue_id` `upload_queue_id` INT(10) UNSIGNED NULL ; -ALTER TABLE `HerediVar`.`upload_variant_queue` -ADD COLUMN `variant_id` INT UNSIGNED NOT NULL AFTER `vid`; ALTER TABLE `HerediVar`.`upload_variant_queue` -ADD COLUMN `user_id` INT UNSIGNED NOT NULL AFTER `submission_id`; -ALTER TABLE `HerediVar`.`upload_variant_queue` -CHANGE COLUMN `submission_id` `submission_id` INT(11) NULL ; - - -ALTER TABLE `HerediVar`.`upload_queue` -RENAME TO `HerediVar`.`publish_queue` ; +RENAME TO `HerediVar`.`publish_heredicare_queue` ; GRANT SELECT,INSERT,UPDATE ON HerediVar.publish_queue TO 'HerediVar_superuser'; GRANT SELECT ON HerediVar.publish_queue TO 'HerediVar_user'; @@ -52,10 +55,13 @@ GRANT SELECT,INSERT,UPDATE ON HerediVar.publish_heredicare_queue TO 'HerediVar_s GRANT SELECT,UPDATE ON HerediVar.publish_heredicare_queue TO 'HerediVar_user'; GRANT SELECT,UPDATE ON HerediVar.publish_heredicare_queue TO 'HerediVar_read_only'; + ALTER TABLE `HerediVar`.`upload_variant_queue` DROP COLUMN `user_id`, CHANGE COLUMN `upload_queue_id` `publish_queue_id` INT(10) UNSIGNED NULL DEFAULT NULL , RENAME TO `HerediVar`.`publish_heredicare_queue` ; + + ALTER TABLE `HerediVar`.`heredivar_clinvar_submissions` RENAME TO `HerediVar`.`publish_clinvar_queue` ;