database.addCluster("csv", OStorage.CLUSTER_TYPE.PHYSICAL);
database.addCluster("flat", OStorage.CLUSTER_TYPE.PHYSICAL);
database.addCluster("binary", OStorage.CLUSTER_TYPE.PHYSICAL);
OClass account = database.getMetadata().getSchema()
.createClass("Account", database.addCluster("account", OStorage.CLUSTER_TYPE.PHYSICAL));
account.createProperty("id", OType.INTEGER);
account.createProperty("birthDate", OType.DATE);
account.createProperty("binary", OType.BINARY);
database.getMetadata().getSchema().createClass("Company", account);
OClass profile = database.getMetadata().getSchema()
.createClass("Profile", database.addCluster("profile", OStorage.CLUSTER_TYPE.PHYSICAL));
profile.createProperty("nick", OType.STRING).setMin("3").setMax("30").createIndex(INDEX_TYPE.UNIQUE);
profile.createProperty("name", OType.STRING).setMin("3").setMax("30").createIndex(INDEX_TYPE.NOTUNIQUE);
profile.createProperty("surname", OType.STRING).setMin("3").setMax("30");
profile.createProperty("registeredOn", OType.DATETIME).setMin("2010-01-01 00:00:00");
profile.createProperty("lastAccessOn", OType.DATETIME).setMin("2010-01-01 00:00:00");
profile.createProperty("photo", OType.TRANSIENT);
OClass whiz = database.getMetadata().getSchema().createClass("Whiz");
whiz.createProperty("id", OType.INTEGER);
whiz.createProperty("account", OType.LINK, profile);
whiz.createProperty("date", OType.DATE).setMin("2010-01-01");
whiz.createProperty("text", OType.STRING).setMandatory(true).setMin("1").setMax("140").createIndex(INDEX_TYPE.FULLTEXT);
whiz.createProperty("replyTo", OType.LINK, profile);
database.close();
}