added migration generation

This commit is contained in:
wea_ondara
2022-08-14 12:41:44 +02:00
parent 23e046ef7e
commit b11ae150b3
85 changed files with 4206 additions and 121 deletions

View File

@@ -0,0 +1,43 @@
package jef.model;
import jef.DbSet;
import jef.model.annotations.Clazz;
import jef.model.annotations.Id;
import jef.model.annotations.Index;
import jef.model.annotations.Key;
import jef.model.annotations.Unique;
import jef.serializable.SerializableObject;
import lombok.Getter;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class ModelBuilderSimpleTest {
@Test
public void testClone() {
var mb = ModelBuilder.from(Ctx.class);
assertEquals(1, mb.getEntities().size());
assertEquals("objects1", mb.getEntity(TestClass.class).getName());
assertTrue(mb.getEntity(TestClass.class).getFields().stream().allMatch(e -> e.getEntity() == mb.getEntity(TestClass.class)));
}
public static class Ctx extends DbContext {
@Clazz(clazz = TestClass.class)
private DbSet<TestClass> objects1;
}
@Getter
public static class TestClass extends SerializableObject {
@Id
public int i = 1;
public Object o = new Object();
public double d;
public float f;
public long l;
}
}