/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SEC_GATEDLAUNCHAPPUSER') 
 CREATE TABLE T_SEC_GATEDLAUNCHAPPUSER (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SEC_GATEDLAUNCHAPP') 
 CREATE TABLE T_SEC_GATEDLAUNCHAPP (
FID BIGINT DEFAULT 0 NOT NULL,
FAPPID VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FVERSION VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_GATEDLAUNCHAPP' AND KSQL_COL_NAME ='FAPPIDS') 
 ALTER TABLE T_SEC_GATEDLAUNCHAPP ADD (FAPPIDS VARCHAR(1024) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_GATEDLAUNCHAPP' AND KSQL_COL_NAME ='APPID') 
 ALTER TABLE T_SEC_GATEDLAUNCHAPP ADD (APPID VARCHAR(50) DEFAULT ' ' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_GATEDLAUNCHAPP' AND KSQL_COL_NAME ='FPRODNUM') 
 ALTER TABLE T_SEC_GATEDLAUNCHAPP ADD (FPRODNUM VARCHAR(50) DEFAULT ' ' );

  EXEC P_ALTERPK 'PK_T_SEC_GATEDLAUNCHAPPUSER', 'T_SEC_GATEDLAUNCHAPPUSER', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SEC_GATEDLAUNCHAPPUSER_FK') CREATE INDEX IDX_SEC_GATEDLAUNCHAPPUSER_FK ON T_SEC_GATEDLAUNCHAPPUSER ( FID );


 EXEC P_ALTERPK 'PK_T_SEC_GATEDLAUNCHAPP', 'T_SEC_GATEDLAUNCHAPP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_T_SEC_GATEDAPP_VERSION') CREATE INDEX INDEX_T_SEC_GATEDAPP_VERSION ON T_SEC_GATEDLAUNCHAPP ( FAPPNUMBER ,FVERSION );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
