/* SERVICES */
$servicesEntity = new Entity($database, "services");
$servicesEntity->setPresentation("name");
$servicesEntity->addField("name", VARCHAR, 50);
$servicesEntity->addField("script", VARCHAR, 100);
$servicesEntity->addField("entry", VARCHAR, 30);
$servicesEntity->addReference($servicecategoryEntity, "servicecategory");
$servicesEntity->addField("visible", VARCHAR, 1);
$servicesEntity->addField("des", TEXT);
$servicesEntity->addReference($entitiesEntity, "id_entities");
$servicesEntity->addReference($groupsEntity, "superuser_group");
$servicesEntity->addField("position", POSITION);
$servicesEntity->connect();
/* SERVICES-GROUPS */
$servicesGroupsRelation = new Relation($servicesEntity, $groupsEntity);
$servicesGroupsRelation->connect();
/* LOGGING */
$logEntity = new Entity($database, "logs");
$logEntity->setPresentation("date", "entity", "operation");
$logEntity->addField("operation", VARCHAR, 20);
$logEntity->addField("entity", VARCHAR, 100);
$logEntity->addField("itemid", VARCHAR, 255);
$logEntity->addField("service", VARCHAR, 100);
/* the following abstract from the users key definition 
   which was VARCHAR (15) before
 
*/
$logEntity->addReference($usersEntity, "username");
// $logEntity->addField("username", VARCHAR, 15);
$logEntity->addField("date", LONGDATE);
$logEntity->addField("ip", VARCHAR, 15);