CREATE TABLE REQUEST_MAPPING(
	ID_INTERNAL int(11) NOT NULL auto_increment,
	PATH varchar(255) NOT NULL,
	PARAMETERS text NULL,
	KEY_ROOT_DOMAIN_OBJECT INTEGER,
	PRIMARY KEY (ID_INTERNAL)
);

CREATE TABLE REQUEST_LOG(
	ID_INTERNAL int(11) NOT NULL auto_increment,
	QUERY_STRING text NOT NULL,
	REQUEST_TIME DATETIME NOT NULL,
	REQUESTER varchar(255),
	REQUEST_ATTRIBUTES text NULL,
	SESSION_ATTRIBUTES text NULL,	
	KEY_ROOT_DOMAIN_OBJECT INTEGER,
	KEY_MAPPING INTEGER NOT NULL,
	KEY_ERROR_LOG INTEGER NULL,
	PRIMARY KEY (ID_INTERNAL)
);

CREATE TABLE ERROR_LOG(
	ID_INTERNAL int(11) NOT NULL auto_increment,
	STACK_TRACE text NULL,
	KEY_ROOT_DOMAIN_OBJECT INTEGER,
	KEY_EXCEPTION INTEGER NOT NULL,
	PRIMARY KEY (ID_INTERNAL)
);

CREATE TABLE EXCEPTION_TYPE(
	ID_INTERNAL int(11) NOT NULL auto_increment,
	TYPE varchar(255) NOT NULL,
	KEY_ROOT_DOMAIN_OBJECT INTEGER,
	PRIMARY KEY (ID_INTERNAL),
	UNIQUE KEY `TYPE` (`TYPE`)
);
