marcin mank <marcin.mank@gmail.com> writes:
> On Fri, Feb 11, 2011 at 8:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hmm. That seems like it would require a rather pathological collection
>> of upgrade scripts. In particular why would you have a one-step upgrade
>> from 1.1 to 2.0 but no short path from 1.2?
> Say we have 20 versions, with up- and downgrade scripts between
> consecutive versions, and a fast path from 5 to 20.
> if we are at version 6, it would go 6->5->20. if 6->5 drops a table,
> we`re in trouble.
So basically, to get into trouble you need all three of these elements:
1. A downgrade script;
2. A fast-path upgrade script that reverses the effect of the downgrade
and skips at least two versions further than that;
3. An irreversible action in the downgrade script.
That seems sufficiently far-fetched to me that documenting the hazard
ought to be enough (and I've done so).
If we could identify downgrade scripts, it would be easy enough to
modify the shortest-path algorithm to not use them unless necessary
(by assigning them a very large weight instead of weight 1). However,
I'm still not excited about defining a version comparison rule just for
that. One possibility is to invent a file naming rule that marks
downgrade scripts, for example an extra dash:
extension-oldversion-newversion-.sql
I'm really not convinced it's worth the trouble, though.
regards, tom lane