<?xml version="1.0" encoding="utf-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
    <changeSet author="shg" id="1619520700565-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="area_id"/>
            </not>
        </preConditions>
        <comment>p_point add column area_id</comment>
        <sql>
            ALTER TABLE `p_point`
            ADD COLUMN `area_id` bigint(20) DEFAULT NULL COMMENT '物理区域id（数据来源于装备wl_area）';
        </sql>
    </changeSet>
    <changeSet author="wjk" id="1619683142000-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="area_name"/>
            </not>
        </preConditions>
        <comment>p_point add column area_id</comment>
        <sql>
            ALTER TABLE `p_point`
            ADD COLUMN `area_name` varchar(255) DEFAULT NULL COMMENT '物理区域名称（数据来源于装备wl_area）';
        </sql>
    </changeSet>
    
     <changeSet author="maoying" id="16272868380001-1">
        <preConditions onFail="MARK_RAN">
             <columnExists tableName="p_plan_task" columnName="user_dept"/>
        </preConditions>
        <comment>MODIFY user_dept </comment>
        <sql>
           ALTER TABLE `p_plan_task`
			MODIFY COLUMN `user_dept`  varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '人员部门信息';
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="16272868380001-2">
        <preConditions onFail="MARK_RAN">
             <columnExists tableName="p_plan_task" columnName="user_name"/>
        </preConditions>
        <comment>MODIFY user_name </comment>
        <sql>
           ALTER TABLE `p_plan_task`
			MODIFY COLUMN `user_name`  varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户姓名' ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="16272868380001-3">
        <preConditions onFail="MARK_RAN">
             <columnExists tableName="p_check" columnName="user_id"/>
        </preConditions>
        <comment>MODIFY user_id </comment>
        <sql>
           ALTER TABLE `p_check`
			MODIFY COLUMN `user_id`  varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '巡检人id，有可能有多个以,隔开';
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="16272868380001-4">
        <preConditions onFail="MARK_RAN">
             <columnExists tableName="p_check" columnName="dep_id"/>
        </preConditions>
        <comment>MODIFY dep_id </comment>
        <sql>
           ALTER TABLE `p_check`
			MODIFY COLUMN `dep_id`  varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '执行部门ids' ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="16272868380001-5">
        <preConditions onFail="MARK_RAN">
             <columnExists tableName="p_check" columnName="dep_name"/>
        </preConditions>
        <comment>MODIFY dep_name </comment>
        <sql>
           ALTER TABLE `p_check`
			MODIFY COLUMN `dep_name`  varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '执行部门名称';
        </sql>
    </changeSet>

    <changeSet author="tb" id="tb-202109101731-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_latent_danger" columnName="biz_type"/>
            </not>
        </preConditions>
        <comment>p_latent_danger add COLUMN biz_type '业务类型（不同业务创建的隐患以此区分）'</comment>
        <sql>
            ALTER TABLE p_latent_danger add COLUMN `biz_type` varchar(30) DEFAULT NULL COMMENT '业务类型（不同业务创建的隐患以此区分）' after
            `id`;
        </sql>
    </changeSet>
    <changeSet author="tb" id="tb-202109101731-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_latent_danger" columnName="longitude"/>
            </not>
        </preConditions>
        <comment>p_latent_danger add COLUMN longitude '隐患地址经度'</comment>
        <sql>
            ALTER TABLE p_latent_danger add COLUMN `longitude` varchar(30) DEFAULT NULL COMMENT '隐患地址经度' after
            `danger_position`;
        </sql>
    </changeSet>
    <changeSet author="tb" id="tb-202109101731-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_latent_danger" columnName="latitude"/>
            </not>
        </preConditions>
        <comment>p_latent_danger add COLUMN latitude '隐患地址纬度'</comment>
        <sql>
            ALTER TABLE p_latent_danger add COLUMN `latitude` varchar(30) DEFAULT NULL COMMENT '隐患地址纬度' after
            `longitude`;
        </sql>
    </changeSet>
</databaseChangeLog>