------------------------------------------------------------------------------
--- Copyright (c) 1998-2011 Luna Imaging, Inc.  All Rights Reserved.
---
--- This software is confidential and proprietary information of
--- Luna Imaging, Inc.  ("Confidential Information").  You shall not
--- disclose such Confidential Information and shall use it only in
--- accordance with the terms of the license agreement you entered into
--- with Luna Imaging, Inc.
---
--- The software may not be copied, reproduced, translated or reduced to
--- any electronic medium or machine-readable form without
--- the prior written consent of Luna Imaging.
---
--- You are not allowed to distribute the binary and source code
--- (if released) to third parties, without the prior written consent from
--- Luna Imaging.
---
--- You are not allowed to reverse engineer, disassemble or decompile
--- code, or make any modifications of the binary or source code, remove
--- or alter any trademark, logo, copyright or other proprietary notices,
--- legends, symbols, or labels in the Software.
---
--- You are not allowed to sub-license the Software or any derivative
--- work based on or derived from the Software.
---
--- LUNA IMAGING MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
--- OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
--- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
--- PURPOSE, OR NON-INFRINGEMENT, LUNA IMAGING SHALL NOT BE LIABLE FOR ANY
--- DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
--- DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
------------------------------------------------------------------------------

------------------------------------------------
-- Drop Table Statements
------------------------------------------------

DROP TABLE CREDENTIALROLES;
DROP SEQUENCE CREDENTIALROLES_seq;
DROP TABLE ROLESPERMISSIONS;
DROP SEQUENCE ROLESPERMISSIONS_seq;

 
------------------------------------------------
-- Create Table Statements for CREDENTIALROLES
------------------------------------------------  

CREATE TABLE CREDENTIALROLES(
	ID NUMBER NOT NULL,
	CREDENTIALSID NUMBER  NULL,
	ROLENAME VARCHAR2(100)  NULL );

ALTER TABLE CREDENTIALROLES
  ADD CONSTRAINT PK_CREDENTIALROLES
  PRIMARY KEY (ID);
  
create sequence CREDENTIALROLES_seq 
  start with 1 
  increment by 1 
  nomaxvalue;  
	
-- Create Trigger CREDENTIALROLES_trigger
create trigger CREDENTIALROLES_trigger before insert on CREDENTIALROLES for each row when (new.id is null) begin select CREDENTIALROLES_seq.nextval into :new.id from dual; end;;

  
------------------------------------------------
-- Create Table Statements for ROLESPERMISSIONS
------------------------------------------------  

CREATE TABLE ROLESPERMISSIONS(
	ID NUMBER NOT NULL,
	ROLENAME VARCHAR2(100)  NULL,
	PERMISSION VARCHAR2(100)  NULL );

ALTER TABLE ROLESPERMISSIONS
  ADD CONSTRAINT PK_ROLESPERMISSIONS
  PRIMARY KEY (ID);
  
create sequence ROLESPERMISSIONS_seq 
  start with 1 
  increment by 1 
  nomaxvalue;  
	
-- Create Trigger ROLESPERMISSIONS_trigger
create trigger ROLESPERMISSIONS_trigger before insert on ROLESPERMISSIONS for each row when (new.id is null) begin select ROLESPERMISSIONS_seq.nextval into :new.id from dual; end;;


ALTER TABLE USERS MODIFY (PASSWORD VARCHAR2(100));