/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2016 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_DEFERRED_MESSAGES
  (device_id               varchar2(400)       NOT NULL
  ,message                 varchar2(4000)      NOT NULL
  ,notification_id         number              NOT NULL
  ,first_attempt           date                NOT NULL
  ,attempts                number
  ,last_attempt            date
  ,last_error              varchar2(4000)
  ,CONSTRAINT fk_DeviceId FOREIGN KEY (device_id) REFERENCES xxas_user_devices(device_id));

GRANT ALL ON XXAS_DEFERRED_MESSAGES TO &1 WITH GRANT OPTION;

COMMIT;
EXIT;
