/*
 * @(#)General.ddl	1.11 03/09/19
 *
 * Warning: This file was generated programmatically by mof2ddl.
 *          Do not make changes to this file or they will be lost!
 *
 * Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of Sun
 * Microsystems, 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 Sun.
 *
 * SUN 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. SUN SHALL NOT BE LIABLE FOR
 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

-- SQL script to create general Storade Tables.


CREATE TABLE ReferenceForMSE
(
        mseID                   INTEGER,
        type                    INTEGER,
        systemClassName         VARCHAR,
        systemName              VARCHAR,
        creationClassName       VARCHAR,
        keyName                 VARCHAR,
        keyValue                VARCHAR
);

CREATE TABLE NSMEvent
(
        eventID			VARCHAR,
	source			VARCHAR,
	sourceSequenceNumber	BIGINT,
	sourceTime		TIMESTAMP,
	type			VARCHAR,
	topic			VARCHAR,
	severity		INTEGER,
	correlatedEvents	VARCHAR[],
	subject			VARCHAR,
	subjectTime		BIGINT,
        payloadtype             VARCHAR,
        payload                 VARCHAR
);

CREATE TABLE NSMEventRelatedInfo
(
        eventID			VARCHAR,
        subjectDisplayName	VARCHAR,
	subjectFlavor		VARCHAR,
	subjectVendor		VARCHAR,
	subjectModel		VARCHAR,
        subjectParentUID	VARCHAR,
	subjectParentDisplayName	VARCHAR,
	subjectParentFlavor	VARCHAR,
	subjectParentVendor	VARCHAR,
	subjectParentModel	VARCHAR
);

CREATE TABLE Alarm
(
        eventID			VARCHAR,
	source			VARCHAR,
	sourceSequenceNumber	BIGINT,
	sourceTime		TIMESTAMP,
	type			VARCHAR,
	topic			VARCHAR,
	severity		INTEGER,
	correlatedEvents	VARCHAR[],
	subject			VARCHAR,
	subjectTime		BIGINT,
        payloadtype             VARCHAR,
        payload                 VARCHAR,
        ackTime                 BIGINT,
        ackBy                   VARCHAR,
        isAcked                 BOOLEAN,
        note                    VARCHAR,
        isCleared               BOOLEAN,
        clearTime               BIGINT
);

CREATE TABLE Identity
(
	FKOID			BIGINT,
	type			VARCHAR,
	value			VARCHAR,
        CONSTRAINT unique_row
          UNIQUE(fkoid, type, value)
);

CREATE INDEX identity_value_index ON identity (value);


CREATE TABLE Type
(
	dbid			BIGINT,
	flavor			VARCHAR,
	vendor			VARCHAR,
	model			VARCHAR
);


CREATE SEQUENCE LocalizeProps_seq CYCLE;

CREATE TABLE LocalizeProps (
    SeqNum     INTEGER DEFAULT NEXTVAL('LocalizeProps_seq'),
    ResBundle   VARCHAR,
    Locale      VARCHAR,
    Key         VARCHAR,
    Value       VARCHAR,
    CONSTRAINT LocalizeProps_CONSTRAINT_1 
        PRIMARY KEY (ResBundle, Locale, Key, Value)
);

