/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\LOG_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APPSETTING' AND KSQL_COL_NAME ='FAPPLOGRETAINDAYS') 
 ALTER TABLE T_LOG_APPSETTING ADD (FAPPLOGRETAINDAYS INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APPSETTING' AND KSQL_COL_NAME ='FARCHIVEDCOUNT') 
 ALTER TABLE T_LOG_APPSETTING ADD (FARCHIVEDCOUNT INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APPSETTING' AND KSQL_COL_NAME ='FUPGRADESTATUS') 
 ALTER TABLE T_LOG_APPSETTING ADD (FUPGRADESTATUS VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APPSETTING' AND KSQL_COL_NAME ='FCURRENTSTEP') 
 ALTER TABLE T_LOG_APPSETTING ADD (FCURRENTSTEP VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APPSETTING' AND KSQL_COL_NAME ='FDUMPEDCOUNT') 
 ALTER TABLE T_LOG_APPSETTING ADD (FDUMPEDCOUNT INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FOPNAMEE') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FOPNAMEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FOPDESCRIPTIONE') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FOPDESCRIPTIONE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FCLIENTNAMEE') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FCLIENTNAMEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
 --- drop column --------- 不允许删除表T_LOG_ARCHIVE的字段FOPNAME，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_LOG_ARCHIVE的字段FOPDESCRIPTION，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_LOG_ARCHIVE的字段FCLIENTNAME，请恢复pdm中的字段 ------------------- 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FOPNAMEE') 
 ALTER TABLE T_LOG_APP ADD (FOPNAMEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FOPDESCRIPTIONE') 
 ALTER TABLE T_LOG_APP ADD (FOPDESCRIPTIONE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FCLIENTNAMEE') 
 ALTER TABLE T_LOG_APP ADD (FCLIENTNAMEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
 --- drop column --------- 不允许删除表T_LOG_APP的字段FOPNAME，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_LOG_APP的字段FOPDESCRIPTION，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_LOG_APP的字段FCLIENTNAME，请恢复pdm中的字段 ------------------- 

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