/**Begin D:\softwaresetup\PDM_UPGRADE\PDM1\kd_1.5.84_fpm_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_DIMADD' AND KSQL_COL_NAME IN ('FBODYSYSTEM')) 
 ALTER TABLE T_FPM_DIMADD ADD (FBODYSYSTEM BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_MEMBER' AND KSQL_COL_NAME IN ('FBODYSYSTEM')) 
 ALTER TABLE T_FPM_MEMBER ADD (FBODYSYSTEM BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_MEMBER' AND KSQL_COL_NAME IN ('FDIMENSIONID')) 
 ALTER TABLE T_FPM_MEMBER ADD (FDIMENSIONID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_TEMPLATE_SUBJECT' AND KSQL_COL_NAME IN ('FISLEAF')) 
 ALTER TABLE T_FPM_TEMPLATE_SUBJECT ADD (FISLEAF CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATE_SUBJECTME') 
 CREATE TABLE T_FPM_TEMPLATE_SUBJECTME (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATEUSER') 
 CREATE TABLE T_FPM_TEMPLATEUSER (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATE_LAYOUT') 
 CREATE TABLE T_FPM_TEMPLATE_LAYOUT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLAYOUTDIM BIGINT DEFAULT 0 NOT NULL,
FDIMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMLEVEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FISEXPANDMEM CHAR(1) DEFAULT '0' NOT NULL,
FDIMHIDE CHAR(1) DEFAULT '0' NOT NULL,
FISCONTAINTOTAL CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATE_LAYOUTMEM') 
 CREATE TABLE T_FPM_TEMPLATE_LAYOUTMEM (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



/**End D:\softwaresetup\PDM_UPGRADE\PDM1\kd_1.5.84_fpm_table.sql **/
