Eli Mesika has uploaded a new change for review.

Change subject: core: Adding support for installing functions that are needed 
for an upgrade script
......................................................................

core: 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 functions
Those 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 upgarde 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 refreshstoredprocedures 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
---
M backend/manager/dbscripts/dbfunctions.sh
M backend/manager/dbscripts/upgrade.sh
2 files changed, 30 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/14/1214/1
--
To view, visit http://gerrit.ovirt.org/1214
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91de335159a6c87c0f9d7f1383da25bb93b4a684
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to