We use the ant sql task to do this in the build section of the pom, in 
conjunction with DBUnit tests:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>3.0.10</version>
                        </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>sql-test-compile</id>
                        <phase>test-compile</phase>
                        <configuration>
                                <tasks>
                                        <sql
                                            driver="com.mysql.jdbc.Driver"
                                            url="jdbc:mysql://127.0.0.1/"
                                            userid="user"
                                            password="pass"
                                            onerror="continue">
                                                <transaction>
                                                        drop database my_db;
                                                </transaction>
                                                <transaction>
                                                        create database my_db;
                                                </transaction>
                                                <transaction  
src="src/main/resources/database/mysql/load_test_data.sql"/>                    
                                          </sql>
                                </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>


...etc 

Hope this helps.
Kieran


>
>no, they're just databases (SQL) (by schema i mean definitions of tables
>and stored procedures)
>
>andrew
>
>Piéroni Raphaël wrote:
>> Do your database schema use Torque oà r hibernate ?
>>
>> Raphaël
>>
>> 2006/2/21, andrew cooke <[EMAIL PROTECTED]>:
>>>
>>>
>>> Hi,
>>>
>>> I have a DB schema that defines a database.  I'd like Maven to manage
>>> this
>>> (so that I can delete/re0create the database before tests, for example).
>>> How do I do this?
>>>
>>> Thanks,
>>> Andrew
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to