use of com.github.drinkjava2.jdialects.model.TableModel in project jDialects by drinkjava2.
the class DDLTest method testANormalModel.
@Test
public void testANormalModel() {
// A normal setting
TableModel t = new TableModel("testTable");
t.column("b1").BOOLEAN();
t.column("d2").DOUBLE();
t.column("f3").FLOAT(5);
t.column("i4").INTEGER().pkey();
t.column("l5").LONG();
t.column("s6").SHORT();
t.column("b7").BIGDECIMAL(10, 2);
t.column("s8").STRING(20);
t.column("d9").DATE();
t.column("t10").TIME();
t.column("t11").TIMESTAMP();
t.column("v12").VARCHAR(300);
printAllDialectsDDLs(t);
testOnCurrentRealDatabase(t);
}
use of com.github.drinkjava2.jdialects.model.TableModel in project jDialects by drinkjava2.
the class DDLTest method testEngineTailAndColumnTail.
@Test
public void testEngineTailAndColumnTail() {
// engineTail and column Tail
TableModel t = new TableModel("tailsTestTable");
t.engineTail(" DEFAULT CHARSET=utf8");
t.column("id").STRING(20).pkey();
t.column("name").STRING(20).tail(" default 'hahaha'");
printOneDialectsDDLs(Dialect.Oracle10gDialect, t);
printOneDialectsDDLs(Dialect.H2Dialect, t);
printOneDialectsDDLs(Dialect.MySQL5InnoDBDialect, t);
printOneDialectsDDLs(Dialect.MariaDB53Dialect, t);
testOnCurrentRealDatabase(t);
}
use of com.github.drinkjava2.jdialects.model.TableModel in project jDialects by drinkjava2.
the class DDLTest method allowNullModel.
private static TableModel allowNullModel() {
// Allow Null
TableModel t = new TableModel("testTable");
t.column("b1").BOOLEAN();
t.column("d2").DOUBLE();
t.column("f3").FLOAT(5);
t.column("i4").INTEGER();
t.column("l5").LONG();
t.column("s6").SHORT();
t.column("b7").BIGDECIMAL(10, 2);
t.column("s8").STRING(20);
t.column("d9").DATE();
t.column("t10").TIME();
t.column("t11").TIMESTAMP();
t.column("v12").VARCHAR(300);
return t;
}
use of com.github.drinkjava2.jdialects.model.TableModel in project jDialects by drinkjava2.
the class DDLTest method autoGeneratorModel2.
private static TableModel autoGeneratorModel2() {
// autoGenerator
TableModel t = new TableModel("testTable2");
t.tableGenerator("tbgen7", "tb1", "pkcol4", "valcol", "pkval5", 1, 10);
t.column("i1").INTEGER().pkey().autoId();
t.column("i2").INTEGER().autoId();
t.column("i3").INTEGER().autoId();
return t;
}
use of com.github.drinkjava2.jdialects.model.TableModel in project jDialects by drinkjava2.
the class DDLTest method checkModel.
private static TableModel checkModel() {
// column check
TableModel t = new TableModel("testTable");
t.column("s1").STRING(20).notNull().check("s1>5");
t.column("s2").STRING(20).check("s2>5");
t.column("s3").STRING(20).notNull().check("s3>5");
t.column("s4").STRING(20).check("s4>5");
return t;
}
Aggregations