-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMigrationPlugin.java
More file actions
35 lines (29 loc) · 885 Bytes
/
MigrationPlugin.java
File metadata and controls
35 lines (29 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package io.ebean.migration.db;
import io.ebean.migration.MigrationConfig;
import io.ebean.plugin.Plugin;
import io.ebean.plugin.SpiServer;
/**
* @author Roland Praml, FOCONIS AG
*/
public class MigrationPlugin implements Plugin {
private MigrationConfig config = new MigrationConfig();
private SpiServer server;
@Override
public void configure(SpiServer server) {
config.setName(server.name());
config.load(server.config().getProperties());
this.server = server;
if (server.config().isRunMigration() && config.isPluginRun()) {
throw new UnsupportedOperationException("You cannot enable both 'migration.run' and 'migration.plugin.run'");
}
}
@Override
public void online(boolean online) {
if (online && config.isPluginRun()) {
new MigrationRunnerDb(config, server).run();
}
}
@Override
public void shutdown() {
}
}