/**Begin E:\PDM\PDM1\kd_1.5.128_bd_admindivisionlog_alter.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINNAME') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINNAME VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINPARENTID') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINPARENTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINLEVEL') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINLEVEL BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINADMINDIVISIONLVID') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINADMINDIVISIONLVID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINSIMPLESPELL') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINSIMPLESPELL VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINFULLSPELL')
ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINFULLSPELL VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINLONGNUMBER') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINLONGNUMBER VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINFULLNAME') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINFULLNAME VARCHAR(1024) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINAREACODE') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINAREACODE VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FORIGINDESCRIPTION') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FORIGINDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ADMINDIVISIONLOG' AND KSQL_COL_NAME ='FISCHILDREN') 
 ALTER TABLE T_BD_ADMINDIVISIONLOG ADD (FISCHILDREN CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PRESET_LOG' AND KSQL_COL_NAME ='FRESTORESTATUS') 
 ALTER TABLE T_BD_PRESET_LOG ADD (FRESTORESTATUS VARCHAR(50) DEFAULT '0' NOT NULL);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PRESET_LOG' AND KSQL_COL_NAME ='FRESTORERID') 
 ALTER TABLE T_BD_PRESET_LOG ADD (FRESTORERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PRESET_LOG' AND KSQL_COL_NAME ='FRESTORETIME') 
 ALTER TABLE T_BD_PRESET_LOG ADD (FRESTORETIME DATETIME );

/**End E:\PDM\PDM1\kd_1.5.128_bd_admindivisionlog_alter.sql **/
