Change in ovirt-engine[master]: core: Adding support for installing functions ...

Eli Mesika has submitted this change and it was merged. Change subject: core: Adding support for installing functions ... ...................................................................... core: Adding support for installing functions ... Adding support for installing functions that are needed for an upgrade script Consider the following You are writing an upgrade script that is doing lot of data manipulations using local functionsThose functions should be called also after upgrade completed when data in the system is modified Now , those functions are dependant on a new object created lets say ,table T which was added in a prev upgrade script.You can not add those functions to the common_sp.sql since it runs before the upgrade scripts and at that point table T is not valid yet. You can duplicate the functions and handle a local copy in the upgrade script and another in the *_sp.sql file but this code duplication is a mess and may lead to problems.You can install the functions only from the upgrade script and not drop then at the end, but then, if you have some fixes to the functions , they will not run again after the upgrade script is executed and the refreshstoredprocedure s script will not refresh the code. The solution that I suggest here is to enable adding one or more lines at the start of the upgrade script with the format: --#source sql_file for example : --#source myfunctions_sp.sql This will run myfunctions_sp.sql and install its functions before the upgrade script is running and keep functions (that are not temporary) in the *_sp.sql files so we can fix a function and refreshstoredprocedures will install the fixed code. Change-Id: I91de335159a6c87c0f9d7f1383da25bb93b4a684 Signed-off-by: Eli Mesika <emesika@redhat.com> --- M backend/manager/dbscripts/dbfunctions.sh M backend/manager/dbscripts/upgrade.sh 2 files changed, 32 insertions(+), 0 deletions(-) Approvals: Eli Mesika: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/1214 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I91de335159a6c87c0f9d7f1383da25bb93b4a684 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emesika@redhat.com> Gerrit-Reviewer: Eli Mesika <emesika@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzaslavs@redhat.com>
participants (1)
-
emesika@redhat.com