<?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="suhuiguang" id="1587367889717-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="last_check_id"/>
            </not>
        </preConditions>
        <comment>p_point ADD COLUMN last_check_id</comment>
        <sql>
             ALTER TABLE p_point ADD COLUMN `last_check_id` varchar(32) DEFAULT NULL COMMENT '最近检查记录（漏检不算）' AFTER `original_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1628747347004-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="building_id"/>
            </not>
        </preConditions>
        <comment>p_point ADD COLUMN building_id 需求变更</comment>
        <sql>
            ALTER TABLE p_point ADD COLUMN `building_id` varchar(32) DEFAULT NULL COMMENT '所在建筑' AFTER `address`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1628747347004-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="building_name"/>
            </not>
        </preConditions>
        <comment>p_point ADD COLUMN building_name 需求变更</comment>
        <sql>
            ALTER TABLE p_point ADD COLUMN `building_name` varchar(255) DEFAULT NULL COMMENT '所在建筑名称' AFTER `building_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1628747347004-3">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="p_check_shot" columnName="org_code"/>
        </preConditions>
        <comment>p_check_shot modify COLUMN org_code 需求变更</comment>
        <sql>
            ALTER TABLE p_check_shot modify `org_code` varchar(100) DEFAULT NULL COMMENT '权限系统org code';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check_shot" columnName="photo_conf_key"/>
            </not>
        </preConditions>
        <comment>p_check_shot add COLUMN photo_conf_key 增加项和照片关联</comment>
        <sql>
            ALTER TABLE p_check_shot add COLUMN `photo_conf_key` varchar(32) DEFAULT NULL COMMENT '照片配置key(关联照片和拍照设置)';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_input_item" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_input_item add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_input_item add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_input_item" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_input_item add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_input_item add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_point add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_point add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_point" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_point add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_point add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-6">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_route" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_route add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_route add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-7">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_route" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_route add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_route add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-8">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_plan" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_plan add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_plan add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-9">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_plan" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_plan add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_plan add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-10">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-11">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-12">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_plan_task" columnName="company_id"/>
            </not>
        </preConditions>
        <comment>p_plan_task add COLUMN company_id 维保公司id</comment>
        <sql>
            ALTER TABLE p_plan_task add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1629788256095-13">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_plan_task" columnName="company_name"/>
            </not>
        </preConditions>
        <comment>p_plan_task add COLUMN company_name '维保公司名称'</comment>
        <sql>
            ALTER TABLE p_plan_task add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249901-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="point_no"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN point_no '设备编号'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `point_no` bigint(20) DEFAULT NULL COMMENT '设备编号' after `point_name`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249911-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="risk_and_manage"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN risk_and_manage '风险辨识与管控措施'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `risk_and_manage` varchar(255) DEFAULT NULL COMMENT '风险辨识与管控措施' after `point_no`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249901-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="building_name"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN building_name '安装位置'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `building_name` varchar(255) DEFAULT NULL COMMENT '安装位置' after `risk_and_manage`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249901-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="equipment_name"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN equipment_name '设备分类（装备定义名称）'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN  `equipment_name` varchar(255) DEFAULT NULL COMMENT '设备分类（装备定义名称）' after `building_name`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249901-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="owner_id"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN owner_id '业主单位'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN  `owner_id` varchar(50) DEFAULT NULL COMMENT '业主单位' after `route_name`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249901-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="plan_type"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN plan_type '计划类型：1-日，2-周，3-月，4-年'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `plan_type` varchar(255) DEFAULT NULL COMMENT '计划类型：1-日，2-周，3-月，4-年';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249911-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="begin_time"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN begin_time '开始时间'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `begin_time` datetime DEFAULT NULL COMMENT '开始时间' after `plan_task_detail_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249911-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="end_time"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN end_time '结束时间'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `end_time` datetime DEFAULT NULL COMMENT '结束时间' after `begin_time`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1630291249911-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="p_check" columnName="owner_name"/>
            </not>
        </preConditions>
        <comment>p_check add COLUMN owner_name '业主单位名称'</comment>
        <sql>
            ALTER TABLE p_check add COLUMN `owner_name` varchar(255) DEFAULT NULL COMMENT '业主单位名称' after `owner_id`;
        </sql>
    </changeSet>
</databaseChangeLog>