Menu

I can't apply sql to multi-databases

Users
Anonymous
2012-05-28
2013-04-29
  • Anonymous

    Anonymous - 2012-05-28

    When I used dbmaintain maven plugin to apply sql to multi-databases, only first database changed. pom list bellow:
    <scriptLocations>deltas</scriptLocations>
                                <scriptFileExtensions>sql</scriptFileExtensions>
                                <autoCreateDbMaintainScriptsTable>true</autoCreateDbMaintainScriptsTable>
                                <scriptEncoding>UTF-8</scriptEncoding>
                                <allowOutOfSequenceExecutionOfPatches>true</allowOutOfSequenceExecutionOfPatches>
                                <databases>
                                    <database>
                                        <name>autotest1</name>
                                        <driverClassName>org.postgresql.Driver</driverClassName>
                                        <userName>xxx</userName>
                                        <password>xxx</password>
                                        <url>jdbc:postgresql://a/data?useUnicode=true&amp;characterEncoding=utf8</url>
                                        <schemaNames>public</schemaNames>
                                    </database>
                                    <database>
                                        <name>autotest2</name>
                                        <driverClassName>org.postgresql.Driver</driverClassName>
                                        <userName>xxx</userName>
                                        <password>xxx</password>
                                        <url>jdbc:postgresql://b/data?useUnicode=true&amp;characterEncoding=utf8</url>
                                        <schemaNames>public</schemaNames>
                                    </database>
                                </databases>
                            </configuration>

     
  • Tim Ducheyne

    Tim Ducheyne - 2012-05-28

    If I understand you correctly, you want to execute the same scripts on both databases.
    This cannot be done using the above config.
    The list of databases, is the list of all used databases. The first one is the default one. If you want to execute a script on the second database you have to name your script as follows 02_@autotest2_users.sql

    If you want to do the same scripts on all databases, you will have to invoke dbmaintain 2 times.

    brgds,
    Tim

     

Log in to post a comment.