Eli Mesika has uploaded a new change for review. Change subject: core: adding missing default to a non-null column ......................................................................
core: adding missing default to a non-null column This patch fixes an issue in event_subscriber table that was added a notification_method column which does not allow nulls. If the table has any records before the upgrade, this will fail since the existing records will have NULL for the new added column. Change-Id: Id3c7ce30c32b9b38f08ff6c8c0eb8bfa02cf5066 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1072867 Signed-off-by: Eli Mesika <emes...@redhat.com> --- M packaging/dbscripts/upgrade/03_04_0600_event_notification_methods.sql 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/25412/1 diff --git a/packaging/dbscripts/upgrade/03_04_0600_event_notification_methods.sql b/packaging/dbscripts/upgrade/03_04_0600_event_notification_methods.sql index d515d92..58dca6a 100644 --- a/packaging/dbscripts/upgrade/03_04_0600_event_notification_methods.sql +++ b/packaging/dbscripts/upgrade/03_04_0600_event_notification_methods.sql @@ -3,14 +3,12 @@ DROP TABLE event_notification_methods ; -- save EventNotificationMethod as string with constraint. -ALTER TABLE event_subscriber ADD COLUMN notification_method CHARACTER VARYING(32) +ALTER TABLE event_subscriber ADD COLUMN notification_method CHARACTER VARYING(32) DEFAULT 'EMAIL' CHECK (notification_method IN ('EMAIL', 'SNMP_TRAP')); ALTER TABLE event_subscriber DROP CONSTRAINT pk_event_subscriber; ALTER TABLE event_subscriber ADD CONSTRAINT pk_event_subscriber PRIMARY KEY (subscriber_id, event_up_name, notification_method, tag_name); ALTER TABLE event_subscriber DROP COLUMN method_id; - -UPDATE event_subscriber SET notification_method = 'EMAIL'; ALTER TABLE event_subscriber ALTER notification_method SET NOT NULL; -- To view, visit http://gerrit.ovirt.org/25412 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id3c7ce30c32b9b38f08ff6c8c0eb8bfa02cf5066 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4.0 Gerrit-Owner: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches