mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 18:12:09 +01:00
DDL generation methods
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
7f8be3e195
commit
2870b0e9bc
1 changed files with 16 additions and 0 deletions
|
@ -5,6 +5,8 @@ import com.avaje.ebean.EbeanServer;
|
|||
import com.avaje.ebean.EbeanServerFactory;
|
||||
import com.avaje.ebean.config.DataSourceConfig;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.server.ddl.DdlGenerator;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -241,4 +243,18 @@ public abstract class JavaPlugin implements Plugin {
|
|||
public EbeanServer getDatabase() {
|
||||
return ebean;
|
||||
}
|
||||
|
||||
protected void installDDL() {
|
||||
SpiEbeanServer serv = (SpiEbeanServer)getDatabase();
|
||||
DdlGenerator gen = serv.getDdlGenerator();
|
||||
|
||||
gen.runScript(false, gen.generateCreateDdl());
|
||||
}
|
||||
|
||||
protected void removeDDL() {
|
||||
SpiEbeanServer serv = (SpiEbeanServer)getDatabase();
|
||||
DdlGenerator gen = serv.getDdlGenerator();
|
||||
|
||||
gen.runScript(true, gen.generateDropDdl());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue