/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2014 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

CREATE TABLE XXAS_COM_SRV_REST_AUDIT
  (audit_id               NUMBER         NOT NULL
  ,start_datetime         TIMESTAMP      NOT NULL
  ,end_datetime           TIMESTAMP      NOT NULL
  ,method                 VARCHAR2(80)   NOT NULL
  ,url_path               VARCHAR2(4000) NOT NULL
  ,user_id                NUMBER         NOT NULL
  ,icx_session_id         NUMBER
  ,ip_address             VARCHAR2(80)
  ,geometry               MDSYS.SDO_GEOMETRY
  ,device_type            VARCHAR2(30)
  ,device_os              VARCHAR2(30)
  ,http_request           XMLType);

INSERT INTO USER_SDO_GEOM_METADATA
  (TABLE_NAME
  ,COLUMN_NAME
  ,DIMINFO
  ,SRID) 
VALUES
  ('XXAS_COM_SRV_REST_AUDIT'
  ,'GEOMETRY'
  ,SDO_DIM_ARRAY 
    (SDO_DIM_ELEMENT('LONG', -180.0, 180.0, 1), 
     SDO_DIM_ELEMENT('LAT', -90.0, 90.0, 1)), 
   8307);
  
GRANT ALL ON XXAS_COM_SRV_REST_AUDIT TO &1 WITH GRANT OPTION;

COMMIT; 
EXIT;
