简体   繁体   中英

How to update database with MyBatis?

I use MyBatis, Java, Maven, MySQL and Eclipse IDE.

I have 2 dabases: db1 and db2.

db1 - is my default database.

When in Maven I make migration:up it updates the database (schema) - db1.

How can I make migration:up with MyBatis to update database db2 too?

Create another environment properties in environment folder and specify details of db2 there.

When you run migration:up this uses default environment from migration repository which is development (or in your case some other environment may be specified in mybatis migration maven plugin configuration). You need to create new file in migration repository for example db2.properties and then use it when running maven like this

mvn migration:up -Dmigration.env=db2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM