DROP TABLE IF EXISTS AUDITOR;
CREATE TABLE AUDITOR (
ID_INTERNAL INT(11), 
OID BIGINT(20), 
PERFORMED_BY VARCHAR(255), 
OPERATION_DATE VARCHAR(20), 
GENERIC_OPERATION VARCHAR(150), 
PRIMARY KEY(ID_INTERNAL), 
KEY OID (OID)
) ENGINE = INNODB;

DROP TABLE IF EXISTS AUDIT_OPERATION;
CREATE TABLE AUDIT_OPERATION (
ID_INTERNAL INT(11), 
KEY_ROOT_DOMAIN_OBJECT INT(11),
KEY_AUDITOR INT(11),
OID BIGINT(20), 
OID_ROOT_DOMAIN_OBJECT BIGINT(20),
OID_AUDITOR BIGINT(20),
OBJECT_ID INT(20),
OPERATION VARCHAR(15), 
INSTANT VARCHAR(20), 
MESSAGE TEXT,
OBJECT_CLASS VARCHAR(200),
PRIMARY KEY(ID_INTERNAL), 
KEY OID (OID), 
KEY OID_ROOT_DOMAIN_OBJECT (OID_ROOT_DOMAIN_OBJECT),
KEY OID_AUDITOR (OID_AUDITOR),
KEY KEY_ROOT_DOMAIN_OBJECT (KEY_ROOT_DOMAIN_OBJECT),
KEY KEY_AUDITOR (KEY_AUDITOR)
) ENGINE = INNODB;