views:

99

answers:

2

How do I instruct Nant to tell MySql to run ddl scripts from a particular location and then run other scripts as instructed?

Google let me to many sites which unfortunately do not work...

+3  A: 

I use a nant script to recreate mysql stored procedures from files stored on a "procedures" folder. My Nant target looks like:

<target name="migrate-storeds" description="Creates stored procedures">
    <echo message="Creating Stored Procedures"/>
    <foreach item="File" property="filename">
    <in>
        <items>
            <include name="procedures\*.sql"></include>
        </items>
    </in>
    <do>
        <echo message="filename ${filename}"/>
        <exec program="${mysql.path}\mysql"
            workingdir="."
            failonerror="true"
            commandline='--host=${database.server} --user=${database.user} --password=${database.pwd} ${database.name} -e "source ${filename}"'/>
    </do>
    </foreach>
    <echo message="Procedures created succesfully"/>
</target>
Elph
+1  A: 

You should be able to run scripts ddl against MySql using the <sql> task in the NAntContrib project. <sql> requires an OLEDB connection, and as far as I can tell MySql supports this.

Peter Lillevold