use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method checkModel.
private static Table checkModel() {
// column check
Table t = new Table("testTable");
t.column("s1").STRING(20).unique().notNull().check("s1>5");
t.column("s2").STRING(20).unique().check("s2>5");
t.column("s3").STRING(20).unique("uname1").notNull().check("s3>5");
t.column("s4").STRING(20).unique("uname2").check("s4>5");
return t;
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method testFKEY.
@Test
public void testFKEY() {
// FKEY
Table t = new Table("master");
t.column("id").INTEGER().pkey();
t.column("name").STRING(20);
t.column("address").INTEGER().pkey();
Table t2 = new Table("child");
t2.column("id").INTEGER().pkey();
t2.column("address2").VARCHAR(20).fkey("master", "name", "address");
t2.column("masterid3").VARCHAR(20).fkey("master", "id");
t2.column("aaaaa").VARCHAR(20).fkey("master", "name", "address");
printAllDialectsDDLs(t, t2);
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method tableGeneratorModel.
private static Table tableGeneratorModel() {
// tableGenerator
Table t = new Table("testTable");
t.addTableGenerator("tbgen1", "tb1", "pkcol", "valcol", "pkval", 1, 10);
t.addTableGenerator("tbgen2", "tb1", "pkcol2", "valcol", "pkval", 1, 10);
t.column("i1").INTEGER().pkey().tableGenerator("tbgen1");
t.column("i2").INTEGER().pkey().tableGenerator("tbgen2");
return t;
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class ColumnDDLTest method tableModel.
private static Table tableModel() {
Table t = new Table(testTable);
t.column("b1").BOOLEAN();
t.column("d2").DOUBLE();
t.column("f3").FLOAT();
t.column("i4").INTEGER().pkey().unique().notNull().defaultValue("1");
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.Table in project jDialects by drinkjava2.
the class TableTest method testCompondPkey.
@Test
public void testCompondPkey() {
// Compound PKEY
Table t = new Table("testTable");
t.column("i4").INTEGER().pkey().unique().notNull().defaultValue("1");
t.column("l5").LONG().pkey();
t.column("s6").SHORT();
printAllDialectsDDLs(t);
}
Aggregations