[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [UDD] How to properly maintain code in sql dir



Hi Lucas,

On Fri, May 17, 2013 at 12:11:50PM +0200, Lucas Nussbaum wrote:
> On 17/05/13 at 11:20 +0200, Andreas Tille wrote:
> > > The current way is:
> > > setup.sql contains the code to generate a pristine UDD db from scratch.
> > > upgrade.sql lists the command needed to upgrade a running UDD db. You
> > > can't run it, but you can copy-paste from it.
> > 
> > I think it would make some sense to be able to run it.
> 
> Yes, do you want to investigate how this can be done?

Well, at first we need to decide why some pieces of code are residing in
upgrade.sql and not in setup.sql.  For instance I would question the

  CREATE TABLE upstream ...

in upgrades.sql - it is just in setup.sql so there is no point in
duplicating this here.

If there would be some reason for recreating a table you should just use

   DROP TABLE IF EXISTS foo;
   DROP TABLE IF EXISTS bar CASCADE;

Regarding functions I'm always using

   CREATE OR REPLACE FUNCTION baz ()

so this is safe for running.  But in all cases I simply missing any
motivation for having those things in upgrade once they are inside
the UDD production database.

> > So I'm tempted to move the additional code from blends.sql into
> > setup.sql and run the code manually.  Is this correct?
> 
> Yes.

OK.  I'll do so.

> > Kind regards
> > 
> >        Andreas.
> > 
> > PS:  Perhaps we should add your short explanation to the README file.
> 
> Yes.

Commited (00c726f) as quote from your mail.  Because it is not mentioned
inside your explanation explicitly:  Is my way to test new code in extra
files (like blends.sql) missuse or it is fine to have these files in Git
as long as they are not in official UDD?

Kind regards

       Andreas.

-- 
http://fam-tille.de


Reply to: