
io.ebeaninternal.server.deploy.DbMigrationInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.deploy;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.ebean.annotation.Platform;
/**
* Class to hold the DDL-migration information that is needed to do correct alters.
*
* @author Roland Praml, FOCONIS AG
*/
public class DbMigrationInfo {
private final List preAdd;
private final List postAdd;
private final List preAlter;
private final List postAlter;
private final List platforms;
public DbMigrationInfo(String[] preAdd, String[] postAdd, String[] preAlter, String[] postAlter, Platform[] platforms) {
this.preAdd = toList(preAdd);
this.postAdd = toList(postAdd);
this.preAlter = toList(preAlter);
this.postAlter = toList(postAlter);
this.platforms = toList(platforms);
}
private List toList(T[] scripts) {
if (scripts.length == 0) {
return Collections.emptyList();
} else {
return Collections.unmodifiableList(Arrays.asList(scripts));
}
}
public List getPreAdd() {
return preAdd;
}
public List getPostAdd() {
return postAdd;
}
public List getPreAlter() {
return preAlter;
}
public List getPostAlter() {
return postAlter;
}
public List getPlatforms() {
return platforms;
}
public String joinPlatforms() {
if (platforms.isEmpty()) {
return null;
} else {
StringBuilder sb = new StringBuilder();
for (Platform p : platforms) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(p.name().toLowerCase());
}
return sb.toString();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy