diff --git a/roles/database/files/upgrade/8.5.2.sql b/roles/database/files/upgrade/8.5.2.sql index 66a482e53..c5372e9ce 100644 --- a/roles/database/files/upgrade/8.5.2.sql +++ b/roles/database/files/upgrade/8.5.2.sql @@ -1,14 +1,14 @@ DO $do$ BEGIN - IF EXISTS (SELECT color_name FROM stm_color WHERE color_name='crete blue') THEN - INSERT INTO stm_color (color_name, color_rgb) VALUES ('crete blue', '485cd4') + IF NOT EXISTS (SELECT color_name FROM stm_color WHERE color_name='crete blue') THEN + INSERT INTO stm_color (color_name, color_rgb) VALUES ('crete blue', '485cd4'); END IF; - IF EXISTS (SELECT color_name FROM stm_color WHERE color_name='state blue') THEN - INSERT INTO stm_color (color_name, color_rgb) VALUES ('state blue', 'a186ed') + IF NOT EXISTS (SELECT color_name FROM stm_color WHERE color_name='state blue') THEN + INSERT INTO stm_color (color_name, color_rgb) VALUES ('state blue', 'a186ed'); END IF; - IF EXISTS (SELECT color_name FROM stm_color WHERE color_name='olive') THEN - INSERT INTO stm_color (color_name, color_rgb) VALUES ('olive', '617d28') + IF NOT EXISTS (SELECT color_name FROM stm_color WHERE color_name='olive') THEN + INSERT INTO stm_color (color_name, color_rgb) VALUES ('olive', '617d28'); END IF; - IF EXISTS (SELECT color_name FROM stm_color WHERE color_name='dark gold') THEN - INSERT INTO stm_color (color_name, color_rgb) VALUES ('dark gold', 'cdad00') + IF NOT EXISTS (SELECT color_name FROM stm_color WHERE color_name='dark gold') THEN + INSERT INTO stm_color (color_name, color_rgb) VALUES ('dark gold', 'cdad00'); END IF; -END $do$; \ No newline at end of file +END $do$;