create table if not exists __schema__
(target_namespace longblob not null,
 schema_id longblob not null,
 internal_schema_id bigint not null,
 schema_definition longblob not null,
 deleted boolean not null default 0,
 timestamp timestamp,
 index(target_namespace(128),schema_id(128),internal_schema_id,deleted));

create table if not exists __element__
(element_namespace longblob not null,
 element_name longblob not null,
 element_internal_schema_id bigint not null,
 type_namespace longblob not null,
 type_name longblob not null,
 type_internal_schema_id bigint not null,
 deleted boolean not null default 0,
 timestamp timestamp,
 index(element_namespace(128),element_name(128),element_internal_schema_id,type_internal_schema_id,deleted));

create table if not exists __type__
(type_namespace longblob not null,
 type_name longblob not null,
 schema_uri longblob not null,
 internal_schema_id bigint not null,
 deleted boolean not null default 0,
 timestamp timestamp,
 index(type_namespace(128),type_name(128),schema_uri(128),deleted));

create table if not exists __universal_name_alias__
(namespace longblob not null,
 local_name longblob not null,
 id_number integer unique,
 id longblob not null,
 alias longblob not null,
 deleted boolean not null default 0,
 timestamp timestamp,
 index(namespace(128),local_name(128),id_number,id(128),alias(128),deleted));

create table if not exists __coord_trans__
(id longblob,
 source_coord longblob,
 target_coord longblob,
 source_dimension integer not null,
 target_dimension integer not null,
 method longblob not null,
 value longblob,
 deleted boolean not null default 0,
 index(id(128),source_coord(128),target_coord(128), source_dimension, target_dimension, deleted));

create table if not exists __transaction_log__
(id integer not null auto_increment,
 uri longblob not null,
 timestamp timestamp,
 request_from longblob,
 type longblob,
 info longblob,
 index(id, uri(128)));
