Hi Chris, It has been my experience of ~2.5 years that the order is maintained with a <srcFile> list, though I see nothing in the plugin docs that specifically mentions this, nor have I had the time (or inclination) to read the source... We have a relatively small number of sql files, 4 in one place, 2 in another, so it is not too bad for us to list them all by name. FWIW, we are using version 1.4 of the plugin.
Cheers, John On Thu, Oct 14, 2010 at 10:27 AM, Chris Odney <chris.od...@gmail.com> wrote: > Hi John, > > I never noticed the option of <srcFiles> as against <fileset> > > My understanding is the list of files specified using <srcFiles> are > executed in the order they are specified whereas it is not so in the case > of > <fileset>(this is when orderFile attribute is not specified). Am I wrong? > > Thanks for the reply, > Chris. > > On Thu, Oct 14, 2010 at 7:33 PM, John Singleton <john.te...@gmail.com > >wrote: > > > Hi Chris, > > > > #2 is probably the best to ensure repeatability in the order you want. > It > > also prevents inadvertent re-ordering if a new sql file is introduced > into > > the sql directory. In our project, we use srcFiles rather than fileset: > > > > <srcFiles> > > <srcFile>[file1]</srcFile> > > <srcFile>[file2}</srcFile> > > ... > > </srcFiles> > > > > HTH, > > John Singleton > > > > On Thu, Oct 14, 2010 at 9:25 AM, Chris Odney <chris.od...@gmail.com> > > wrote: > > > > > Hi, > > > > > > I am facing some problem in ordering the sql execution. > > > > > > We have one sql script file for each table under one directory. Ex: > There > > > is > > > user.sql and role.sql in the directory c:\SqlScripts. We are using the > > sql > > > maven plugin to execute these sql files. > > > > > > The role table has a Foriegn key to the user table and the execution is > > > failing because the plugin is trying to execute the role.sql before > > > user.sql. I cannot use the orderfile attribute as we specify the > > <fileset> > > > as c:\SqlScripts\*.sql. > > > > > > How do I overcome this problem? > > > > > > I see 2 solutions: > > > > > > 1) Merge all scripts into one file in the creation order, the script to > > > create role comes after the script to create user. > > > > > > 2)Remove the * wildcard and specify each file in the <filelist> > attribute > > > in > > > the order of execution. > > > > > > 3)Number the name of the files according to the execution order ex: > > > 1_user.sql, 2_role.sql and use the 'ascending' orderfile attribute(not > > sure > > > if this would work though, as the ordering may not be applied) > > > > > > Any more elegant solutions? > > > > > > Thank you, > > > Chris. > > > > > >