Re: upgrading the main database

Markus Hoenicka <[email protected]> Thu, 28 Sep 2006 10:19:34 +0200
Newsgroups gmane.text.refdb.devel
Message-ID <[email protected]>
Markus Hoenicka <[email protected]> was heard to say:

> > The postinstall script checks for a main refdb database.  If none is
> > found it automatically creates a main sqlite database using the sqlite
> > dump.  Now that you have versioned the dump files it will be difficult
> > for the postinstall script to know which dump file to import.  I could
> > include a loop in which it checks each refdb.[ver].dump.sqlite and
> > determines the largest 'ver'.  It would be easier, however, for me (and,
> > I presume, other packagers) if the newest dump file had a predictable,
> > stable name.  Could you call the newest version 'refdb.dump.sqlite' with
> > only older versions numbered?  When the newest version is replaced it
> > would then be renamed to include the version number and the replacement
> > (now the newest) would receive the unversioned name.  Alternately, and
> > to avoid any possible confusion, the newest dump might be called
> > 'refdb.newest.dump.sqlite' or 'refdb.latest.dump.sqlite'.
> >
>
> I was thinking along these lines too. I think I'll reverse the current
> filenames
> to refdb.dump.sqlite and version only the older ones.
>

Now that I turned my brain on again (it must have been offline yesterday...),
renaming the files is not necessary. Your postinstall script should simply rely
on refdbd -a doing the right thing if it is run unconditionally. As mentioned
before, if the main database is at the current version, this command will do
nothing. If the main database is too old, it will be upgraded. If there is no
main database, it will be created. Therefore you no longer need to know which
dump file to use, and you no longer need a dependency on the sqlite binary
either. refdbd -a will do all this for you.

regards,
Markus

-- 
Markus Hoenicka
[email protected]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV