--
--    Licensed Materials - Property of IBM
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2003, 2015
--    
--    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
--    

-------------------------------------------------------------------------------
-- NC_CREATE_IFX.sql         *  DO NOT EDIT  *          Data Store Version: 1032
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$200-- tables create begin
-------------------------------------------------------------------------------


CREATE TABLE NC_CONFIGURATION(
    PROPERTY_KEY VARCHAR(255) NOT NULL,
    PROPERTY_VALUE VARCHAR(255)
) lock mode row;

CREATE TABLE NC_CTMAP(
    OBJTYPE SMALLINT NOT NULL,
    CLASS VARCHAR(200),
    TABLENAME VARCHAR(200) NOT NULL,
    HELPER VARCHAR(200),
    REMOTECLASS VARCHAR(200)
) lock mode row;

CREATE TABLE NC_DB_VERSION(
    DB_VERSION_ID INTEGER,
    BUILD VARCHAR(20)
) lock mode row;

CREATE TABLE NC_DELIVERYADDRESS(
    PK_DELADDRESS_ID INTEGER NOT NULL,
    DELIVERY_ADDRESS VARCHAR(100),
    CHANNEL_TYPE INTEGER,
    IS_DEFAULT INTEGER NOT NULL,
    FK_RECIPIENT_ID INTEGER,
    ADDRESS_TYPE INTEGER
) lock mode row;

CREATE TABLE NC_EVENTSTATUS(
    PK_EVENT_ID CHAR(45) NOT NULL,
    EVENT_STATUS INTEGER NOT NULL,
    CONVERSATION INTEGER,
    SDS_INSTANCE_ID CHAR(32)
) lock mode row;

CREATE TABLE NC_JMSQUEUE(
    QUEUE_ENTRY_ID INTEGER NOT NULL,
    QUEUE_NAME LVARCHAR(440),
    QUEUE_ENTRY BLOB,
    SDS_INSTANCE_ID CHAR(32),
    DATE_ENTERED DECIMAL(19,0) NOT NULL,
    REDELIVER_DATE DECIMAL(19,0),
    REDELIVER_COUNT INTEGER DEFAULT 0
) lock mode row;

CREATE TABLE NC_JOBQUEUE(
    PK_RUN_ID VARCHAR(45) NOT NULL,
    SERVICE_NAME VARCHAR(40),
    SERVER_GROUP VARCHAR(40),
    DATE_ENTERED DECIMAL(19,0) NOT NULL,
    JOB BLOB NOT NULL
) lock mode row;

CREATE TABLE NC_MESSAGELINE(
    FK_MESSAGESTRUCT_ID INTEGER NOT NULL,
    LINE_NO INTEGER NOT NULL,
    LINE_TYPE INTEGER
) lock mode row;

CREATE TABLE NC_MESSAGELINE_ELEMENT(
    FK_MESSAGESTRUCT_ID INTEGER NOT NULL,
    ELEMENT_NUMBER INTEGER NOT NULL,
    LINE_NO INTEGER NOT NULL,
    TEXT LVARCHAR(4000),
    FK_BIE_TOPIC_ID INTEGER
) lock mode row;

CREATE TABLE NC_MESSAGESTRUCT(
    PK_MS_ID INTEGER NOT NULL,
    FK_DYNREC_ID INTEGER,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    SOURCE VARCHAR(100),
    SUBJECT VARCHAR(210),
    MODCOUNT INTEGER DEFAULT -1,
    LASTMOD_BY VARCHAR(50),
    CHANNEL_TYPE INTEGER,
    CONTACT VARCHAR(50),
    CREDENTIAL LVARCHAR(1024),
    AVOID_DUPLICATION INTEGER DEFAULT 0 NOT NULL
) lock mode row;

CREATE TABLE NC_METRICS(
    NAME VARCHAR(255) NOT NULL,
    LASTMOD_TIME DECIMAL(19,0) DEFAULT 0 NOT NULL,
    VALUE DECIMAL(19,0) DEFAULT 0 NOT NULL,
    ACTIVE INTEGER DEFAULT 0 NOT NULL
) lock mode row;

CREATE TABLE NC_OBJECTCATALOGUE(
    PK_OID INTEGER NOT NULL,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    SUBTYPE SMALLINT,
    TYPE INTEGER NOT NULL,
    MODCOUNT INTEGER DEFAULT -1,
    CM_VERSION INTEGER DEFAULT -1
) lock mode row;

CREATE TABLE NC_OBJECTID(
    OBJECTID INTEGER NOT NULL
) lock mode row;

CREATE TABLE NC_PERMISSION(
    PK_PERMISSION_ID INTEGER NOT NULL,
    DESCRIPTION VARCHAR(30) NOT NULL
) lock mode row;

CREATE TABLE NC_RECIPIENT(
    PK_RECIPIENT_ID INTEGER NOT NULL,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    LASTMOD_BY CHAR(40),
    LASTMOD_TIME DATETIME YEAR TO FRACTION (5) DEFAULT CURRENT YEAR TO FRACTION(5) NOT NULL,
    MODCOUNT INTEGER DEFAULT -1,
    TITLE VARCHAR(10),
    FIRSTNAME VARCHAR(50),
    MIDDLENAME VARCHAR(50),
    LASTNAME VARCHAR(50),
    PHONENUMBER VARCHAR(50),
    JOBTITLE VARCHAR(50),
    COMPANY VARCHAR(255),
    DEPARTMENT VARCHAR(255),
    OFFICE VARCHAR(255),
    COUNTRY VARCHAR(50),
    TIMEZONE VARCHAR(50),
    TO_REDIRECT INTEGER NOT NULL,
    FK_REDIRECT_RID INTEGER,
    FK_REDIRECT_RGID INTEGER,
    IS_EXTERNAL INTEGER,
    IS_USEDEFAULTADDRESS INTEGER
) lock mode row;

CREATE TABLE NC_SCHEDULE(
    PK_SCHEDULE_ID INTEGER NOT NULL,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    LASTMOD_BY CHAR(40),
    LASTMOD_TIME DATETIME YEAR TO FRACTION (5) DEFAULT CURRENT YEAR TO FRACTION(5) NOT NULL,
    MODCOUNT INTEGER DEFAULT -1,
    SCHEDULE_TYPE VARCHAR(6),
    TIMEZONE VARCHAR(100),
    START_DATE DECIMAL(19,0),
    END_DATE DECIMAL(19,0),
    REPEAT_FOREVER INTEGER,
    ACTIVE INTEGER,
    VALID_SCHEDULE INTEGER,
    USE_DAY_NUMBER INTEGER,
    DAY_OF_MONTH INTEGER,
    DAY_OF_WEEK INTEGER,
    DAY_OF_WEEK_IN_MONTH INTEGER,
    MONTH_OF_YEAR INTEGER,
    REPEAT_INTERVAL INTEGER,
    DAYS_OF_WEEK INTEGER,
    FIXED_INTERVAL_TYPE INTEGER,
    FIXED_INTERVAL_IN_MILLIS DECIMAL(19,0),
    TRIGGER_ID VARCHAR(255),
    PERIODICAL_PRODUCER_ID CHAR(33),
    INTERDAY_RECUR_START INTEGER,
    INTERDAY_RECUR_END INTEGER,
    INTERDAY_RECUR_INTERVAL INTEGER
) lock mode row;

CREATE TABLE NC_SCHEDULE_QUEUE(
    SCHEDULE_ID INTEGER NOT NULL,
    RUN_DATE DECIMAL(19,0)
) lock mode row;

CREATE TABLE NC_SDS_INSTANCE(
    PK_INSTANCE_ID CHAR(32) NOT NULL,
    PK_INSTANCE_URL VARCHAR(255) NOT NULL,
    LAST_UPDATE DECIMAL(19,0) NOT NULL,
    CLEANUP_INSTANCE_ID CHAR(32)
) lock mode row;

CREATE TABLE NC_TASK(
    PK_TASK_ID INTEGER NOT NULL,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    FK_BIE_ID INTEGER,
    THRESHOLD INTEGER,
    WEIGHTS VARCHAR(200),
    TASK_TYPE INTEGER,
    DATEFORMAT CHAR(19),
    DETECTION_OPTION INTEGER,
    LASTMOD_TIME DATETIME YEAR TO FRACTION (5) DEFAULT CURRENT YEAR TO FRACTION(5),
    MODCOUNT INTEGER DEFAULT -1,
    LASTMOD_BY CHAR(40),
    LOCATION_ROOT LVARCHAR(256),
    OBJECT_CLASS LVARCHAR(256),
    OWNED_BY LVARCHAR(1024)
) lock mode row;

CREATE TABLE NC_TASKSCHEDULE(
    PK_TASKSCHEDULE_ID INTEGER NOT NULL,
    FK_TASK_ID INTEGER,
    NAME VARCHAR(255),
    DESCRIPTION LVARCHAR(1000),
    LASTMOD_BY CHAR(40),
    MODCOUNT INTEGER DEFAULT -1 NOT NULL,
    RUN_REQUIREMENTS INTEGER,
    LAST_EXECUTION_AT DECIMAL(19,0),
    NEXT_EXECUTION_REQUEST DECIMAL(19,0),
    SCHEDULE_DELAY DECIMAL(19,0),
    DELETE_AFTER_LAST_RUN INTEGER,
    PRIORITY INTEGER DEFAULT 3 NOT NULL,
    SCHEDULED_BY LVARCHAR(1024),
    TENANT_ID LVARCHAR(255) DEFAULT ''
) lock mode row;

CREATE TABLE NC_SCHEDULED_EVENT_OVERRIDE(
    FK_TASKSCHEDULE_ID INTEGER NOT NULL,
    EVENT_DATE DECIMAL(19,0) NOT NULL,
    DELAY_UNTIL DECIMAL(19,0),
    EVENT_STATUS INTEGER,
    EVENT_PRIORITY INTEGER,
    FK_SCHEDULE_ID INTEGER,
    CANCELLED_BY LVARCHAR(2000)
) lock mode row;

CREATE TABLE NC_TASK_ANCESTOR_STOREIDS(
    TASK_ID CHAR(45) NOT NULL,
    ANCESTOR_STORE_ID LVARCHAR(256) NOT NULL
) lock mode row;

CREATE TABLE NC_TASK_HISTORY_DETAIL(
    TASK_ID CHAR(45) NOT NULL,
    SUB_INDEX INTEGER NOT NULL,
    SEVERITY INTEGER,
    CLASSTYPE VARCHAR(128),
    TASK BLOB,
    STATUS INTEGER DEFAULT 0 NOT NULL
) lock mode row;

CREATE TABLE NC_TASK_HISTORY_SUB_INDEX(
    TASK_ID CHAR(45) NOT NULL,
    LAST_SUB_INDEX INTEGER NOT NULL
) lock mode row;

CREATE TABLE NC_TASK_PROPERTY(
    TASK_ID CHAR(45) NOT NULL,
    PROP_NAME VARCHAR(45) NOT NULL,
    PROP_VALUE LVARCHAR(2000)
) lock mode row;

CREATE TABLE NC_TASK_QUEUE(
    TASK_ID CHAR(45) NOT NULL,
    SERVICE_NAME VARCHAR(40),
    SERVER_GROUP VARCHAR(40),
    DATE_ENTERED DECIMAL(19, 0) NOT NULL,
    TASK BLOB,
    STATUS INTEGER NOT NULL,
    PRIORITY INTEGER NOT NULL,
    RESTART_ID CHAR(45),
    SDS_INSTANCE_ID CHAR(32),
    HISTORY_STORE_ID CHAR(34),
    ACTUAL_EXECUTION_TIME DECIMAL(19, 0),
    ACTUAL_COMPLETION_TIME DECIMAL(19, 0),
    DISPATCHER_ID CHAR(45),
    SCHEDULE_TRIGGER_NAME VARCHAR(255),
    SCHEDULE_TYPE CHAR(15),
    ACCOUNT_PATH LVARCHAR(1024),
    STOREID CHAR(34),
    OBJECT_CLASS CHAR(64),
    OWNER_STOREID LVARCHAR(1024),
    PROCESS_ID INTEGER,
	TARGET_DISPATCHER_ID CHAR(45),
	TENANT_ID LVARCHAR(255) DEFAULT ''
) lock mode row;

CREATE TABLE NC_TSE_STATE_MAP(
    TASK_ID CHAR(45) NOT NULL,
    STATUS INTEGER,
    SEQ INTEGER,
    STEP_COUNT INTEGER,
    CUR_SEQ INTEGER,
    COUNT_SEQ INTEGER,
    STOP_ON_ERROR INTEGER,
    RUN_VIA_MS INTEGER,
    STEP_FAILED INTEGER,
    SEQ_ON_END INTEGER,
    WRITE_ALL_HISTORIES INTEGER,
    FAIL_STATUS INTEGER,
    PARENT_ID CHAR(45),
    EXECUTING INTEGER DEFAULT 0 NOT NULL,
    MODCOUNT INTEGER DEFAULT -1 NOT NULL
) lock mode row;

CREATE TABLE NC_RESOURCE_LOCK(
	LOCK_RESOURCE nchar(50) NOT NULL,
	OWNER nchar (50) NOT NULL,
	TIMESTAMP DECIMAL(19,0) NOT NULL
) lock mode row;

CREATE TABLE R_MESSAGESTRUCT_TASK(
    FK_MESSAGESTRUCT_ID INTEGER NOT NULL,
    FK_TASK_ID INTEGER NOT NULL
) lock mode row;

CREATE TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF(
    FK_MESSAGESTRUCT_ID INTEGER NOT NULL,
    FK_DELIVERY_INFO_ID INTEGER,
    FK_RECIPIENT_ID INTEGER NOT NULL,
    ADDED_BY_RECIP_ID INTEGER,
    DATE_ADDED DECIMAL(19, 0)
) lock mode row;

CREATE TABLE R_NEWSITEMS_NCOBJECTS(
    NID CHAR(32) NOT NULL,
    FK_NCID INTEGER NOT NULL,
    TYPE SMALLINT
) lock mode row;

CREATE TABLE R_TASKSCHEDULE_SCHEDULE(
    FK_TASKSCHEDULE_ID INTEGER NOT NULL,
    FK_SCHEDULE_ID INTEGER NOT NULL,
    IS_ACTIVE INTEGER,
    IS_ESCALATION INTEGER
) lock mode row;

-------------------------------------------------------------------------------
--$201-- indices create begin
-------------------------------------------------------------------------------

CREATE INDEX I1N_DELIV_ADR
    ON NC_DELIVERYADDRESS(FK_RECIPIENT_ID);

CREATE INDEX IN_JOBQ_SELECTOR
    ON NC_JOBQUEUE(SERVICE_NAME,SERVER_GROUP,DATE_ENTERED);

CREATE INDEX IX_NC_JMSQUEUE
    ON NC_JMSQUEUE(QUEUE_NAME,DATE_ENTERED,SDS_INSTANCE_ID);

CREATE INDEX IX_NC_JMSQUEUE1
    ON NC_JMSQUEUE(QUEUE_NAME,SDS_INSTANCE_ID);

CREATE INDEX I1N_MESSAGELINE
    ON NC_MESSAGELINE(FK_MESSAGESTRUCT_ID);

CREATE INDEX I1N_MESSAGELINE_EL
    ON NC_MESSAGELINE_ELEMENT(FK_MESSAGESTRUCT_ID);

CREATE INDEX I2N_MESSAGELINE_EL
    ON NC_MESSAGELINE_ELEMENT(LINE_NO,FK_MESSAGESTRUCT_ID);

CREATE INDEX I1N_MESSAGESTRUCT
    ON NC_MESSAGESTRUCT(FK_DYNREC_ID);

CREATE INDEX I1N_TASKSCHEDULE
    ON NC_TASKSCHEDULE(FK_TASK_ID);

CREATE INDEX I1N_EVENT_DATES
    ON NC_SCHEDULED_EVENT_OVERRIDE(FK_TASKSCHEDULE_ID);

CREATE INDEX IX_NC_TSE_STATE_MAP
    ON NC_TSE_STATE_MAP(PARENT_ID,SEQ);

CREATE INDEX IX_NC_TSK_Q_SLTR
    ON NC_TASK_QUEUE(STATUS,SERVICE_NAME,SERVER_GROUP,DATE_ENTERED);

CREATE INDEX I1N_TASKQUEUERESTARTID 
	ON NC_TASK_QUEUE (RESTART_ID);

CREATE INDEX I1R_MESSAGESTRUCT_
    ON R_MESSAGESTRUCT_TASK(FK_MESSAGESTRUCT_ID);

CREATE INDEX I1R_MSGSTRUCT_RECI
    ON R_MSGSTRUCT_RECIPIENT_DELIVINF(FK_MESSAGESTRUCT_ID);

CREATE INDEX I1R_NEWSITEMS_NCOB
    ON R_NEWSITEMS_NCOBJECTS(TYPE);

CREATE INDEX I2R_NEWSITEMS_NCOB
    ON R_NEWSITEMS_NCOBJECTS(FK_NCID);

CREATE INDEX I3R_NEWSITEMS_NCOB
    ON R_NEWSITEMS_NCOBJECTS(FK_NCID,NID);

CREATE INDEX I1R_TASKSCHEDULE_S
    ON R_TASKSCHEDULE_SCHEDULE(FK_TASKSCHEDULE_ID);

CREATE INDEX I2N_SCHEDULE_Q
    ON NC_SCHEDULE_QUEUE(SCHEDULE_ID, RUN_DATE);

-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_CONFIGURATION
 ADD CONSTRAINT  PRIMARY KEY(PROPERTY_KEY) CONSTRAINT PN_CONFIGURATION;

ALTER TABLE NC_CTMAP
 ADD CONSTRAINT  PRIMARY KEY(OBJTYPE) CONSTRAINT PN_CTMAP;

ALTER TABLE NC_DELIVERYADDRESS
 ADD CONSTRAINT  PRIMARY KEY(PK_DELADDRESS_ID) CONSTRAINT PN_DELIVERYADDRESS;

ALTER TABLE NC_EVENTSTATUS
 ADD CONSTRAINT  PRIMARY KEY(PK_EVENT_ID) CONSTRAINT PN_NC_EVENTSTATUS;

ALTER TABLE NC_JOBQUEUE
 ADD CONSTRAINT  PRIMARY KEY(PK_RUN_ID) CONSTRAINT PN_JOBQUEUE;

ALTER TABLE NC_JMSQUEUE
 ADD CONSTRAINT  PRIMARY KEY(QUEUE_ENTRY_ID) CONSTRAINT PN_NC_JMSQUEUE;

ALTER TABLE NC_MESSAGELINE
 ADD CONSTRAINT  PRIMARY KEY(LINE_NO,FK_MESSAGESTRUCT_ID) CONSTRAINT PN_MESSAGELINE;

ALTER TABLE NC_MESSAGELINE_ELEMENT
 ADD CONSTRAINT  PRIMARY KEY(LINE_NO,ELEMENT_NUMBER,FK_MESSAGESTRUCT_ID) CONSTRAINT PN_MESSAGELINE_ELE;

ALTER TABLE NC_MESSAGESTRUCT
 ADD CONSTRAINT  PRIMARY KEY(PK_MS_ID) CONSTRAINT PN_MESSAGESTRUCT;

ALTER TABLE NC_METRICS
 ADD CONSTRAINT  PRIMARY KEY(NAME) CONSTRAINT PN_METRICS;

ALTER TABLE NC_OBJECTCATALOGUE
 ADD CONSTRAINT  PRIMARY KEY(PK_OID) CONSTRAINT PN_OBJECTCATALOGUE;

ALTER TABLE NC_OBJECTID
 ADD CONSTRAINT  PRIMARY KEY(OBJECTID) CONSTRAINT PN_NC_OBJECTID;

ALTER TABLE NC_PERMISSION
 ADD CONSTRAINT  PRIMARY KEY(PK_PERMISSION_ID) CONSTRAINT PN_PERMISSION;

ALTER TABLE NC_RECIPIENT
 ADD CONSTRAINT  PRIMARY KEY(PK_RECIPIENT_ID) CONSTRAINT PN_RECIPIENT;

ALTER TABLE NC_SCHEDULE
 ADD CONSTRAINT  PRIMARY KEY(PK_SCHEDULE_ID) CONSTRAINT PN_SCHEDULE;

ALTER TABLE NC_SCHEDULE_QUEUE
 ADD CONSTRAINT  PRIMARY KEY(SCHEDULE_ID) CONSTRAINT PN_SCHEDULE_QUEUEI;

ALTER TABLE NC_SDS_INSTANCE
 ADD CONSTRAINT  PRIMARY KEY(PK_INSTANCE_ID) CONSTRAINT PN_SDS_INSTANCE;

ALTER TABLE NC_TASK
 ADD CONSTRAINT  PRIMARY KEY(PK_TASK_ID) CONSTRAINT PN_TASK;

ALTER TABLE NC_TASK_ANCESTOR_STOREIDS
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID,ANCESTOR_STORE_ID) CONSTRAINT PK_ANCESTOR_IDS;

ALTER TABLE NC_TASKSCHEDULE
 ADD CONSTRAINT  PRIMARY KEY(PK_TASKSCHEDULE_ID) CONSTRAINT PN_TASKSCHEDULE;

ALTER TABLE NC_TASK_HISTORY_DETAIL
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID,SUB_INDEX) CONSTRAINT PN_TASK_HD;
 
ALTER TABLE NC_TASK_HISTORY_SUB_INDEX
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID) CONSTRAINT PN_TASK_HS;

ALTER TABLE NC_TASK_PROPERTY
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID,PROP_NAME) CONSTRAINT PN_TASK_PROPERTY;

ALTER TABLE NC_TASK_QUEUE
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID) CONSTRAINT PN_TASK_QUEUE;

ALTER TABLE NC_TSE_STATE_MAP
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID) CONSTRAINT PN_TSE_STATE_MAP;

ALTER TABLE NC_SCHEDULED_EVENT_OVERRIDE
 ADD CONSTRAINT  PRIMARY KEY(FK_TASKSCHEDULE_ID,EVENT_DATE) CONSTRAINT PN_EVENT_DATES;

ALTER TABLE R_MESSAGESTRUCT_TASK
 ADD CONSTRAINT  PRIMARY KEY(FK_TASK_ID,FK_MESSAGESTRUCT_ID) CONSTRAINT PR_MESSAGESTRUCT_T;

ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
 ADD CONSTRAINT  PRIMARY KEY(FK_RECIPIENT_ID,FK_MESSAGESTRUCT_ID) CONSTRAINT PR_MSGSTRUCT_RECIP;

ALTER TABLE R_NEWSITEMS_NCOBJECTS
 ADD CONSTRAINT  PRIMARY KEY(NID) CONSTRAINT PR_NEWSITEMS_NCOBJ;

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
 ADD CONSTRAINT  PRIMARY KEY(FK_SCHEDULE_ID,FK_TASKSCHEDULE_ID) CONSTRAINT PR_TASKSCHEDULE_SC;

 ALTER TABLE NC_RESOURCE_LOCK
 	ADD CONSTRAINT  PRIMARY KEY(LOCK_RESOURCE) CONSTRAINT PR_RESOURCE_LOCK;
-------------------------------------------------------------------------------
--$240-- foreign keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_MESSAGELINE
 ADD CONSTRAINT  FOREIGN KEY (FK_MESSAGESTRUCT_ID) REFERENCES NC_MESSAGESTRUCT CONSTRAINT F1N_MESSAGELINE;

ALTER TABLE NC_MESSAGELINE_ELEMENT
 ADD CONSTRAINT  FOREIGN KEY (LINE_NO,FK_MESSAGESTRUCT_ID) REFERENCES NC_MESSAGELINE CONSTRAINT F1N_MESSAGELINE_EL;

ALTER TABLE NC_TASKSCHEDULE
 ADD CONSTRAINT  FOREIGN KEY (FK_TASK_ID) REFERENCES NC_TASK CONSTRAINT F1N_TASKSCHEDULE;

ALTER TABLE R_MESSAGESTRUCT_TASK
 ADD CONSTRAINT  FOREIGN KEY (FK_TASK_ID) REFERENCES NC_TASK CONSTRAINT F2R_MESSAGESTRUCT_;

ALTER TABLE R_MESSAGESTRUCT_TASK
 ADD CONSTRAINT  FOREIGN KEY (FK_MESSAGESTRUCT_ID) REFERENCES NC_MESSAGESTRUCT CONSTRAINT F1R_MESSAGESTRUCT_;

ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
 ADD CONSTRAINT  FOREIGN KEY (FK_RECIPIENT_ID) REFERENCES NC_RECIPIENT CONSTRAINT F3R_MSGSTRUCT_RECI;

ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
 ADD CONSTRAINT  FOREIGN KEY (FK_MESSAGESTRUCT_ID) REFERENCES NC_MESSAGESTRUCT CONSTRAINT F1R_MSGSTRUCT_RECI;

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
 ADD CONSTRAINT  FOREIGN KEY (FK_SCHEDULE_ID) REFERENCES NC_SCHEDULE CONSTRAINT F2R_TASKSCHEDULE_S;

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
 ADD CONSTRAINT  FOREIGN KEY (FK_TASKSCHEDULE_ID) REFERENCES NC_TASKSCHEDULE CONSTRAINT F1R_TASKSCHEDULE_S;

-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('scheduler.queue.factory.class','noticecast.scheduling.core.persistqueue.PersistQueueFactory');

INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('scheduler.queue.loadonstart','true');

INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('scheduler.queue.poll.interval.seconds','30');


INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('job.queue.factory.class','com.cognos.js2.PersistedJobQueueFactory');

INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('job.queue.poll.interval.seconds','30');

INSERT INTO NC_CONFIGURATION (PROPERTY_KEY,PROPERTY_VALUE) VALUES ('sds.instance.update.interval.seconds','30');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (110,'noticecast.logictier.datasource.JDBCDataSourceImpl','NC_CONFIG_DS','noticecast.datatier.datasource.JDBCDhJDBCDataSourceImpl','noticecast.logictier.datasource.JDBCDataSourceRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (111,'noticecast.logictier.datasource.MachineImpl','NC_MACHINE_CONFIG','noticecast.datatier.datasource.JDBCDhMachine',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (112,'noticecast.logictier.datasource.DsPool','NC_DSPOOL','noticecast.datatier.datasource.JDBCDhDsPool',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (115,'noticecast.logictier.datasource.cognos.CognosDataSourceImpl','NC_COGNOS_DS','noticecast.datatier.datasource.cognos.JDBCDhCognosDataSource',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (200,'noticecast.logictier.datamapping.JDBCDataMappingImpl','NCDataMapping','noticecast.datatier.datamapping.JDBCDhJDBCDataMapping','noticecast.logictier.datamapping.JDBCDataMappingRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (210,'noticecast.logictier.datamapping.JDBCDataMappingTopicImpl','NC_DMTOPIC','noticecast.datatier.datamapping.JDBCDhJDBCDataMappingTopic',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (220,'noticecast.logictier.datamapping.powerplay.PPDataMappingImpl','NC_DATAMAPPING','noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMapping',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (221,'noticecast.logictier.datamapping.powerplay.PPCellImpl','NC_DMTOPIC','noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (222,'noticecast.logictier.datamapping.powerplay.PPCellImpl','NC_DMTOPIC','noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (223,'noticecast.logictier.datamapping.powerplay.PPTopicImpl','NC_DMTOPIC','noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (230,'noticecast.logictier.datamapping.cognosquery.CQDataMappingImpl','NC_DATAMAPPING','noticecast.datatier.datamapping.cognosquery.JDBCDhCQDataMapping',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (231,'noticecast.logictier.datamapping.cognosquery.CQTopicImpl','NC_DMTOPIC','noticecast.datatier.datamapping.cognosquery.JDBCDhCQDataMappingTopic',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (300,'noticecast.logictier.bie.BusinessInfoEntityImpl','NC_BIE','noticecast.datatier.bie.JDBCDhBusinessInfoEntityImpl','noticecast.logictier.bie.BusinessInfoEntityRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (301,'noticecast.logictier.bie.BusinessInfoEntityImpl','NC_COGNOS_BIE','noticecast.datatier.bie.JDBCDhBusinessInfoEntityImpl','noticecast.logictier.bie.BusinessInfoEntityRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (311,'noticecast.logictier.bie.BIETopicImpl','NC_BIETopic','noticecast.datatier.bie.JDBCDhBIETopicImpl','noticecast.logictier.bie.BIETopicRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (320,'noticecast.logictier.bie.calculation.CalculationImpl','NC_CALCULATION','noticecast.datatier.bie.calculation.JDBCDhCalculationImpl','noticecast.logictier.bie.calculation.CalculationRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (330,'noticecast.logictier.bie.rules.FilterRuleImpl','NC_FILTER_RULE','noticecast.datatier.bie.rules.JDBCDhFilterRuleImpl','noticecast.logictier.bie.rules.FilterRuleRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (340,'noticecast.logictier.bie.rules.AggregateRuleImpl','NC_AGGREGATE_RULE','noticecast.datatier.bie.rules.JDBCDhAggregateRuleImpl','noticecast.logictier.bie.rules.AggregateRuleRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (350,'noticecast.logictier.bie.rules.ComparativeRuleImpl','NC_COMPARATIVE_RULE','noticecast.datatier.bie.rules.JDBCDhComparativeRuleImpl','noticecast.logictier.bie.rules.ComparativeRuleRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (360,NULL,'NC_RULE','noticecast.datatier.bie.rules.JDBCDhRuleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (700,'noticecast.logictier.recipient.RecipientImpl','NC_RECIPIENT','noticecast.datatier.recipient.JDBCDhRecipientImpl','noticecast.logictier.recipient.RecipientRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (721,'noticecast.logictier.message.attachment.MessageAttachment','NC_MESSAGE_ATTACHMENT',NULL,NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (740,'noticecast.logictier.message.MessageStructImpl','NC_MESSAGESTRUCT','noticecast.datatier.message.JDBCDhJDBCMessageStruct','noticecast.logictier.message.MessageStructRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (741,'noticecast.logictier.dynamicrecipient.DynamicRecipientStructImpl','NC_DYNAMIC_RECIPIENT_STRUCT','noticecast.datatier.dynamicrecipient.JDBCDhDynamicRecipientStructImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (742,'noticecast.logictier.dynamicrecipient.DynamicDeliveryInformationStructImpl','NC_DYN_DELIVERY_INFO_STRUCT','noticecast.datatier.dynamicrecipient.JDBCDhDynamicDeliveryInfoStructImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (745,'noticecast.logictier.recipient.RecipientDeliveryScheduleImpl','NC_RECIPIENTSCHEDULE',NULL,NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (746,'noticecast.logictier.recipient.DeliveryAddressImpl','NC_DELIVERYADDRESS',NULL,NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (900,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask','noticecast.logictier.agent.TaskRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (901,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (902,'noticecast.scheduling.nc.TaskScheduleImpl','NC_TASK_SCHEDULE','noticecast.datatier.scheduling.JDBCDhTaskScheduleImpl','noticecast.scheduling.nc.TaskScheduleRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (905,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (906,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (907,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask','noticecast.logictier.agent.TaskRImpl');

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (908,'noticecast.logictier.agent.TaskImpl','NC_TASK','noticecast.datatier.task.JDBCDhJDBCTask',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (909,'noticecast.logictier.executable.ExecutableImpl','NC_EXECUTABLE','noticecast.datatier.executable.JDBCDhJDBCExecuteable',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1000,'noticecast.scheduling.schedules.YearlySchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1001,'noticecast.scheduling.schedules.MonthlySchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1002,'noticecast.scheduling.schedules.WeeklySchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1003,'noticecast.scheduling.schedules.DailySchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1004,'noticecast.scheduling.schedules.FixedIntervalSchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1005,'noticecast.scheduling.schedules.ISchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1020,'noticecast.scheduling.schedules.ISchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1021,'noticecast.scheduling.schedules.ISchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1022,'noticecast.scheduling.schedules.ISchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1023,'noticecast.scheduling.schedules.ISchedule','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES (1024,' noticecast.scheduling.nc.NcScheduleWrapper','NC_SCHEDULE','noticecast.datatier.scheduling.JDBCDhScheduleImpl',NULL);

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES (1032,'build no.');

INSERT INTO NC_OBJECTID (OBJECTID) VALUES (0);

INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES (1,'Create');

INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES (2,'Read');

INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES (3,'Update');

INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES (4,'Delete');

INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES (5,'Execute');

-------------------------------------------------------------------------------
--	END NC_CREATE_IFX.sql        *  DO NOT EDIT  *  version 1032
-------------------------------------------------------------------------------
