/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2008 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_GRANTEES
  (grant_id                number              PRIMARY KEY
  ,granter_person_id       number              NOT NULL
  ,grantee_person_id       number              NOT NULL
  ,from_date               date                NOT NULL
  ,to_date                 date
  ,relationship_code       varchar2(30)
  ,created_by              number              NOT NULL
  ,creation_date           date                NOT NULL
  ,last_update_date        date                NOT NULL
  ,last_updated_by         number              NOT NULL
  ,last_update_login       number              NOT NULL);

CREATE TABLE XXAS_GRANTEE_PERMISSIONS
  (grant_id                number              NOT NULL
  ,permission_code         number              NOT NULL
  ,created_by              number              NOT NULL
  ,creation_date           date                NOT NULL
  ,last_update_date        date                NOT NULL
  ,last_updated_by         number              NOT NULL
  ,last_update_login       number              NOT NULL
  ,CONSTRAINT grantee_perm_pk PRIMARY KEY (grant_id,permission_code)
  );
  
GRANT ALL ON XXAS_GRANTEES TO &1 WITH GRANT OPTION;

GRANT ALL ON XXAS_GRANTEE_PERMISSIONS TO &1 WITH GRANT OPTION;

COMMIT; 
EXIT;
