mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-20 23:05:23 +00:00
Feature/ddl migration (#1111)
* REFACTOR: use functions from ddl-help * NEW: Default values are written to DDL * fix testcase for sqlserver as default constraints will get names in future * Reading DbMigration * ADD: DbmIgrationGenerateTest * Tables must be created first * Sanity checks and some getters * DdlMigration gets applied now * ADD: Testcase and reference migration scripts * no effective code changes: add comments
This commit is contained in:
1 parent
73b3d1d977
commit
dd8fff0277
90 files changed
+2767
-70
No files matched your search
@@ -17,6 +17,7 @@ import io.ebean.config.dbplatform.DbEncryptFunction;
|
||||
import io.ebeaninternal.server.core.InternString;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.DeployDocPropertyOptions;
|
||||
import io.ebeaninternal.server.deploy.DbMigrationInfo;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
|
||||
import io.ebeaninternal.server.deploy.parse.AnnotationBase;
|
||||
import io.ebeaninternal.server.el.ElPropertyValue;
|
||||
@@ -34,7 +35,9 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -221,6 +224,8 @@ public class DeployBeanProperty {
|
||||
|
||||
private String dbColumnDefault;
|
||||
|
||||
private List<DbMigrationInfo> dbMigrationInfos;
|
||||
|
||||
public DeployBeanProperty(DeployBeanDescriptor<?> desc, Class<?> propertyType, ScalarType<?> scalarType, ScalarTypeConverter<?, ?> typeConverter) {
|
||||
this.desc = desc;
|
||||
this.propertyType = propertyType;
|
||||
@@ -949,7 +954,9 @@ public class DeployBeanProperty {
|
||||
public void checkPrimitiveBoolean() {
|
||||
if (boolean.class.equals(propertyType) && !softDelete) {
|
||||
this.nullable = false;
|
||||
this.dbColumnDefault = DbDefaultValue.FALSE;
|
||||
if (dbColumnDefault == null) {
|
||||
this.dbColumnDefault = DbDefaultValue.FALSE;
|
||||
}
|
||||
|
||||
} else if (!id && !versionColumn && PRIMITIVE_NUMBER_TYPES.contains(propertyType)) {
|
||||
this.nullable = false;
|
||||
@@ -1003,6 +1010,10 @@ public class DeployBeanProperty {
|
||||
return dbColumnDefault;
|
||||
}
|
||||
|
||||
public void setDbColumnDefault(String dbColumnDefault) {
|
||||
this.dbColumnDefault = dbColumnDefault;
|
||||
}
|
||||
|
||||
public void setTenantId() {
|
||||
this.tenantId = true;
|
||||
this.nullable = false;
|
||||
@@ -1013,4 +1024,15 @@ public class DeployBeanProperty {
|
||||
public boolean isTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void addDbMigrationInfo(DbMigrationInfo info) {
|
||||
if (dbMigrationInfos == null) {
|
||||
dbMigrationInfos = new ArrayList<>();
|
||||
}
|
||||
dbMigrationInfos.add(info);
|
||||
}
|
||||
|
||||
public List<DbMigrationInfo> getDbMigrationInfos() {
|
||||
return dbMigrationInfos;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user