/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CENTRALSCHEMEORG') 
 CREATE TABLE T_EB_CENTRALSCHEMEORG (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCOLLECTORGID BIGINT DEFAULT 0 NOT NULL,
FORGSCOPE VARCHAR(5) DEFAULT '10' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CENTRALSCHEMEACCOUNT') 
 CREATE TABLE T_EB_CENTRALSCHEMEACCOUNT (
FID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTSCOPE VARCHAR(5) DEFAULT '10' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);



EXEC P_ALTERPK 'PK_T_EB_CENTRALSCHEMEORG', 'T_EB_CENTRALSCHEMEORG', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_CENTRALSCHEMEORG_P1') CREATE INDEX IDX_EB_CENTRALSCHEMEORG_P1 ON T_EB_CENTRALSCHEMEORG ( FORGID );


EXEC P_ALTERPK 'PK_T_EB_CENTRALSCHEMEACCOUNT', 'T_EB_CENTRALSCHEMEACCOUNT', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_EB_CENTRALSCHEMEACCOUNTT_P1') CREATE INDEX T_EB_CENTRALSCHEMEACCOUNTT_P1 ON T_EB_CENTRALSCHEMEACCOUNT ( FACCOUNTID );

/**End D:\PDM_UPGRADE\PDM1\EB_table.sql **/