/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_STOREKEEPER_AC') 
 CREATE TABLE T_FA_STOREKEEPER_AC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_STOREKEEPERENTRY') 
 CREATE TABLE T_FA_STOREKEEPERENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDIMSTOREKEEPERID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 1 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_STOREKEEPER' AND KSQL_COL_NAME ='FDIMENSION') 
 ALTER TABLE T_FA_STOREKEEPER ADD (FDIMENSION VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSETDRAWBACK_ENTRY' AND KSQL_COL_NAME ='FSTOREKEEPERID') 
 ALTER TABLE T_FA_ASSETDRAWBACK_ENTRY ADD (FSTOREKEEPERID BIGINT DEFAULT 0 NOT NULL );

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