ebean-orm / ebean-migration

DB Migration runner (similar to Flyway) which can be used standalone or with Ebean (run migrations on EbeanServer start)
Apache License 2.0
9 stars 5 forks source link

Migration generation for a second database. #160

Closed Tijs-2 closed 1 week ago

Tijs-2 commented 2 months ago

Hi Rob,

I was looking into migrations and multiple databases was wondering how this works:

If I create tables like this:

@Entity
public class TableA{
    String column;
}

@Entity
@DbName("Database2")
public class TableB{
    String column;
}

Then I want to create the database migrations like this:

    DbMigration dbMigration = DbMigration.create();
    dbMigration.addPlatform(Platform.POSTGRES);
    dbMigration.addPlatform(Platform.MYSQL);
    dbMigration.generateMigration();

But I have no clue how to generate the migrations for the second database.

Kind regards, Tijs

Incanus3 commented 1 month ago

hi @Tijs-2. seems you can simply call dbMigration.setServer(<your Database instance>)

Tijs-2 commented 1 week ago

I solved it indeed, lets close this ticket :)