<?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>
</databaseChangeLog>