use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.
the class TransferFromIli method addModelsTable.
public static void addModelsTable(DbSchema schema, Settings config) {
DbTable tab = new DbTable();
tab.setName(new DbTableName(schema.getName(), DbNames.MODELS_TAB));
DbColVarchar fileCol = new DbColVarchar();
fileCol.setName(DbNames.MODELS_TAB_FILE_COL);
fileCol.setNotNull(true);
fileCol.setSize(250);
tab.addColumn(fileCol);
DbColVarchar iliversionCol = new DbColVarchar();
iliversionCol.setName(DbNames.MODELS_TAB_ILIVERSION_COL);
iliversionCol.setNotNull(true);
iliversionCol.setSize(3);
tab.addColumn(iliversionCol);
DbColVarchar importsCol = new DbColVarchar();
importsCol.setName(DbNames.MODELS_TAB_MODELNAME_COL);
importsCol.setNotNull(true);
int modelNameColSize = DbColVarchar.UNLIMITED;
String modelNameColSizeStr = config.getValue(Config.MODELS_TAB_MODELNAME_COLSIZE);
if (modelNameColSizeStr != null) {
try {
modelNameColSize = Integer.parseInt(modelNameColSizeStr);
} catch (NumberFormatException e) {
}
}
importsCol.setSize(modelNameColSize);
tab.addColumn(importsCol);
DbColVarchar contentCol = new DbColVarchar();
contentCol.setName(DbNames.MODELS_TAB_CONTENT_COL);
contentCol.setNotNull(true);
contentCol.setSize(DbColVarchar.UNLIMITED);
tab.addColumn(contentCol);
DbColDateTime importDateCol = new DbColDateTime();
importDateCol.setName(DbNames.MODELS_TAB_IMPORTDATE_COL);
importDateCol.setNotNull(true);
tab.addColumn(importDateCol);
DbIndex pk = new DbIndex();
pk.setPrimary(true);
pk.addAttr(importsCol);
pk.addAttr(iliversionCol);
tab.addIndex(pk);
schema.addTable(tab);
}
use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.
the class AbstractRecordConverter method addStdCol.
public static void addStdCol(DbTable table) {
DbColumn dbCol = new DbColDateTime();
dbCol.setName(DbNames.T_LAST_CHANGE_COL);
dbCol.setNotNull(true);
table.addColumn(dbCol);
dbCol = new DbColDateTime();
dbCol.setName(DbNames.T_CREATE_DATE_COL);
dbCol.setNotNull(true);
table.addColumn(dbCol);
DbColVarchar dbColUsr = new DbColVarchar();
dbColUsr.setName(DbNames.T_USER_COL);
dbColUsr.setNotNull(true);
dbColUsr.setSize(40);
table.addColumn(dbColUsr);
}
use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.
the class AbstractRecordConverter method addIliTidCol.
public void addIliTidCol(DbTable dbTable, Domain oidDomain) {
if (isUuidOid(td, oidDomain)) {
DbColUuid dbColIliTid = new DbColUuid();
dbColIliTid.setName(DbNames.T_ILI_TID_COL);
// CREATE EXTENSION "uuid-ossp";
dbColIliTid.setDefaultValue(uuid_default_value);
dbTable.addColumn(dbColIliTid);
} else {
DbColVarchar dbColIliTid = new DbColVarchar();
dbColIliTid.setName(DbNames.T_ILI_TID_COL);
dbColIliTid.setSize(200);
dbTable.addColumn(dbColIliTid);
}
}
Aggregations