use of com.servoy.j2db.persistence.IValidateName in project servoy-client by Servoy.
the class I18NMessagesTable method createMessagesTable.
public static ITable createMessagesTable(IServerInternal server, String tablename, int primaryKeySequenceType) throws RepositoryException, SQLException {
// Create the table in the repository.
IValidateName validator = DummyValidator.INSTANCE;
ITable table = server.createNewTable(validator, tablename);
if (primaryKeySequenceType == ColumnInfo.UUID_GENERATOR) {
Column column = table.createNewColumn(validator, "message_id", IColumnTypes.TEXT, 36);
column.setDatabasePK(true);
column.setSequenceType(primaryKeySequenceType);
column.setFlag(IBaseColumn.UUID_COLUMN, true);
} else {
Column column = table.createNewColumn(validator, "message_id", Types.INTEGER, 0, 0, false, true);
column.setSequenceType(primaryKeySequenceType);
}
table.createNewColumn(validator, "message_key", Types.VARCHAR, 150, 0, false);
Column messageLanguage = table.createNewColumn(validator, "message_language", Types.VARCHAR, 150, 0, true);
table.createNewColumn(validator, "message_value", Types.VARCHAR, 2000, 0, true);
server.syncTableObjWithDB(table, false, false);
try {
server.createIndex(table, table.getName() + "_m_l", new Column[] { messageLanguage }, false);
} catch (Exception e) {
Debug.error("Failed to create an index on the messages table", e);
}
return table;
}
Aggregations