Forum OpenACS Improvement Proposals (TIPs): TIP #64: (Approved) Restrictions on upgrade scripts ...

While working to upgrade Sloanspace from 4.6.3 to 5.0, the Sloan team ran into a bunch of problems that can in part be solved if we adopt two minor restrictions on upgrade scripts.  The problems that were run into mostly affect those who don't track upgrades as they come out but rather delay, which requires leapfrogging several upgrades at one time.  While people who do this are almost guaranteed to run into some problems we should do wall we can to simplify the process.

So:

1. (Oracle only) Upgrade scripts should include all PACKAGE declarations before any PACKAGE BODY declaration appears.  Once PACKAGE (i.e. header) declarations are compiled, PACKAGE BODYs can be compiled regardless of dependencies without error.  Andrew Grumet ran into about a half-dozen upgrade errors that were solved by this change.

2. (Oracle and PG) DO NOT include (@ or \i) entire SQL files from the /oracle or /postgresql directories in upgrade scripts!  This only works in the general case if the SQL file is synchronized with the upgrade script, which is not true if you've skipped certain releases ... Andrew ran into a few upgrade problems related to this, too, and had to dig through older *-create.sql versions to dig out the right code to make the interim upgrade scripts work.

If the above is not clear please ask questions.

Collapse
Posted by Dave Bauer on
Don,

So, would an upgrade script for Oracle need to include all procedures and functions in a package/package body? Or can just one function be redefined if that is all that is changed?

Collapse
Posted by Don Baccus on
Upgrade scripts *already* need to do this, Dave.

The restriction is that instead of writing something like

CREATE OR REPLACE PACKAGE FOO ...;
CREATE OR REPLACE PACKAGE BODY FOO ...;

CREATE OR REPLACE PACKAGE BAR ...;
CREATE OR REPLACE PAKCAGE BODY BAR ...;

You must write:

CREATE OR REPLACE PACKAGE FOO ...;
CREATE OR REPLACE PACKAGE BAR ...;

CREATE OR REPLACE PACKAGE BODY FOO ...;
CREATE OR REPLACE PAKCAGE BODY BAR ...;

The first example can lead to dependency errors (as Andrew so painfully learned), the second can't.

Collapse
Posted by Dave Bauer on
Thanks for that example. It makes the TIP quite clear.
Collapse
Posted by Lars Pind on
Approved.

Thanks for tipping this.

marking rejected because this did not get two approval in one week.
Collapse
Posted by Jeff Davis on
I changed this to Approved. It just got overlooked and it did not get voted on mostly since it's almost entirely uncontroversial.