Skip to content

Commit

Permalink
Handle NULL in default/actual values in vdc_options
Browse files Browse the repository at this point in the history
We have discovered that some users still have some ancient options
present in vdc_options (even though they should be removed now), which
contains NULL in default/actual values.
We have fixed fn_db_change_column_type to properly set NULL/NOT NULL
constraints in https://gerrit.ovirt.org/117448 , but we missed above
that ancient options mentioned above still could exist, so we need to
fix those NULL default/actual values before setiing NOT NULL constrain.

Bug-Url: https://bugzilla.redhat.com/2077387
Signed-off-by: Martin Perina <mperina@redhat.com>
  • Loading branch information
mwperina authored and mrkev-gh committed Apr 25, 2022
1 parent 646d2e2 commit c9462ac
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
-- Make sure that forgotten options from ancient releases have default value
UPDATE vdc_options
SET default_value = option_value
WHERE
default_value IS NULL
AND option_value IS NOT NULL;

-- If there are still some crappy options, let's set default value to empty string
UPDATE vdc_options
SET default_value = ''
WHERE
default_value IS NULL
AND option_value IS NULL;

-- We shouldn't have any options with NULL values by now, but let's make sure
UPDATE vdc_options
SET option_value = ''
WHERE option_value IS NULL;

SELECT fn_db_change_column_null('vdc_options', 'default_value', false);
SELECT fn_db_change_column_null('vdc_options', 'option_value', false);

0 comments on commit c9462ac

Please sign in to comment.