`

maven数据库处理插件db-migration-maven-plugin

阅读更多

配置repository:

    <pluginRepositories>
        <pluginRepository>
            <id>c5-public-repository</id>
            <url>http://mvn.carbonfive.com/public</url>
        </pluginRepository>
    </pluginRepositories>

 

配置plugin:

            <plugin>
                <groupId>com.carbonfive.db-support</groupId>
                <artifactId>db-migration-maven-plugin</artifactId>
                <version>0.9.9-m5</version>

                <configuration>
                    <url>jdbc:mysql://localhost:3306/everest</url>
                    <username>root</username>
                    <password>root</password>
                    <migrationsPath>file:src/main/db/migrations/*.sql</migrationsPath>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.6</version>
                    </dependency>
                </dependencies>
            </plugin>

 

将你的数据库删除、创建及初始化语句放在src/main/db/migrations目录下即可。

 

需要重设数据库时只需要执行mvn db-migration:reset即可

 

更多命令请参考: http://code.google.com/p/c5-db-migration/wiki/MavenPlugin

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics