Skip to content

Commit

Permalink
[FSTORE-862][APPEND] Upgrade fix (logicalclocks#1038)
Browse files Browse the repository at this point in the history
* Update 3.4.0.sql

* Update 3.4.0.sql

* Update 3.4.0.sql

* Update 3.4.0.sql

* Update 3.4.0.sql
  • Loading branch information
bubriks authored Sep 13, 2023
1 parent 88a7c89 commit df51e6f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions files/default/sql/ddl/updates/3.4.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ ALTER TABLE `hopsworks`.`feature_group` ADD COLUMN `topic_name` VARCHAR(255) DEF
ALTER TABLE `hopsworks`.`project` ADD COLUMN `topic_name` VARCHAR(255) DEFAULT NULL;

SET SQL_SAFE_UPDATES = 0;
-- deletes unused topics (fg was deleted)
DELETE
FROM `hopsworks`.`project_topics`
WHERE REGEXP_SUBSTR(`topic_name`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)")
AND REGEXP_REPLACE(`topic_name`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)", '$2') NOT IN (SELECT `feature_group`.`id` FROM `feature_group`);

-- deletes unused subjects (fg was deleted)
DELETE
FROM `hopsworks`.`subjects`
WHERE REGEXP_SUBSTR(`subject`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)")
AND REGEXP_REPLACE(`subject`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)", '$2') NOT IN (SELECT `feature_group`.`id` FROM `feature_group`);

UPDATE `hopsworks`.`subjects`
SET `subject` = REGEXP_REPLACE(`subject`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)",'$3_$4')
WHERE REGEXP_SUBSTR(`subject`, "^([0-9]+)_([0-9]+)_(.+)_([0-9]+)(_onlinefs|$)");
Expand Down

0 comments on commit df51e6f

Please sign in to comment.