<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
	<changeSet author="xionglinyao" id="2.2-create-table-bcp_task_definition">
		<preConditions onFail="HALT">
			<not>
				<tableExists tableName="bcp_task_definition" />
			</not>
		</preConditions>
		<createTable tableName="bcp_task_definition">
			<column name="id" type="BINARY(16)">
				<constraints nullable="false" primaryKeyName="PRIMARY" primaryKey="true"/>
			</column>
			<column name="name" type="VARCHAR(200)"/>
			<column name="title" type="VARCHAR(200)"/>
			<column name="event_listener" type="VARCHAR(200)"/>
			<column name="parameters" type="TEXT"/>
			<column name="type" type="VARCHAR(200)"/>
		</createTable>
	    <rollback>
	        <dropTable tableName="bcp_task_definition"/>
	    </rollback>
	</changeSet>
	<changeSet author="lantianxiang" id="2.2-create-table-OAMQMessages">
		<preConditions onFail="HALT">
			<not>
				<tableExists tableName="OAMQMessages" />
			</not>
		</preConditions>
		<createTable tableName="OAMQMessages">
			<column name="MessageId" type="VARCHAR(99)">
				<constraints nullable="false" primaryKeyName="PRIMARY" primaryKey="true"/>
			</column>
			<column name="Sender" type="VARCHAR(50)"/>
			<column name="Sendertime" type="DATETIME"/>
			<column name="Flowtype" type="VARCHAR(50)"/>
			<column name="FlowID" type="VARCHAR(50)"/>
			<column name="Title" type="VARCHAR(66)"/>
			<column name="Nodename" type="VARCHAR(99)"/>
			<column name="PtpUrl" type="VARCHAR(999)"/>
			<column name="Userid" type="VARCHAR(50)"/>
			<column name="Creator" type="VARCHAR(50)"/>
			<column name="Createtime" type="DATETIME"/>
			<column name="Operatetime" type="DATETIME"/>
			<column name="Flowmess" type="INT"/>
			<column name="Viewtype" type="INT"/>
			<column name="STATUS" type="INT"/>
			<column name="ErrorCount" type="INT"/>
			<column name="MessageCreateTime" type="DATETIME"/>
			<column name="AllowMobile" type="INT"/>
			<column name="SenderCode" type="VARCHAR(99)"/>
			<column name="TEMP1" type="VARCHAR(50)"/>
			<column name="TEMP2" type="VARCHAR(50)"/>
			<column name="TEMP3" type="VARCHAR(50)"/>
		</createTable>
	    <rollback>
	        <dropTable tableName="OAMQMessages"/>
	    </rollback>
	</changeSet>
	<changeSet author="lantianxiang" id="2.2-create-table-bcp_workflow_reject_record">
		<preConditions onFail="HALT">
			<not>
				<tableExists tableName="bcp_workflow_reject_record" />
			</not>
		</preConditions>
		<createTable tableName="bcp_workflow_reject_record">
			<column name="id" type="BINARY(16)">
				<constraints nullable="false" primaryKeyName="PRIMARY" primaryKey="true"/>
			</column>
			<column name="reject_process_instance_id" type="BINARY(16)"/>
			<column name="reject_node_id" type="VARCHAR(255)"/>
			<column name="process_instance_id" type="BINARY(16)"/>
			<column name="state" type="INT"/>
		</createTable>
	    <rollback>
	        <dropTable tableName="bcp_workflow_reject_record"/>
	    </rollback>
	</changeSet>
	<changeSet author="xionglinyao" id="2.2-alert-table-bap-department-add-column-description">
		<preConditions onFail="MARK_RAN">
			<not>
				<columnExists tableName="bap_department" columnName="description"/>
			</not>
		</preConditions>
	    <addColumn tableName="bap_department">
		    <column name="description" type="varchar(50)"></column>
	   </addColumn>
	</changeSet>
		<changeSet author="xionglinyao" id="2.2-alert-table-bcp-password-add-columns">
		<preConditions onFail="MARK_RAN">
			<not>
				<columnExists tableName="bcp_password" columnName="password_sign"/>
			</not>
		</preConditions>
	    <addColumn tableName="bcp_password">
		    <column name="password_sign" type="int"></column>
		    <column name="modify_time" type="datetime"></column>
	   </addColumn>
	</changeSet>
	<changeSet author="xionglinyao" id="2.2-add-table-bcp-password-strategy">
		<preConditions onFail="MARK_RAN">
			<not>
				<tableExists tableName="bcp_password_strategy" />
			</not>
		</preConditions>
		<createTable tableName="bcp_password_strategy">
			<column name="id" type="BINARY(16)">
				<constraints nullable="false" primaryKeyName="PRIMARY" primaryKey="true"/>
			</column>
			<column name="password_rule" type="varchar(100)"/>
			<column name="interval_num" type="int"/>
			<column name="failed_num" type="int"/>
		</createTable>
	</changeSet>
	<changeSet author="xionglinyao" id="2.2-add-table-bcp-sequence2">
		<preConditions onFail="MARK_RAN">
			<not>
				<tableExists tableName="bcp_sequence2" />
			</not>
		</preConditions>
		<createTable tableName="bcp_sequence2">
			<column name="seq_name" type="nvarchar(255)">
				<constraints nullable="false" primaryKeyName="PRIMARY" primaryKey="true"/>
			</column>
			<column name="init_value" type="long"/>
			<column name="increment" type="long"/>
			<column name="min_value" type="long"/>
			<column name="max_value" type="long"/>
			<column name="curr_value" type="long"/>
			<column name="next_value" type="long"/>
			<column name="cyclic" type="bit(1)"/>
			<column name="period" type="varchar(10)"/>
			<column name="time" type="datetime"/>
		</createTable>
	</changeSet>
	<changeSet id="2.2-alter-table-bcp-user" author="jiangxuelei">
        <addColumn tableName="bcp_user">
            <column name="id_number" type="varchar(50)"></column>
        </addColumn>
    </changeSet>
    <changeSet author="xionglinyao" id="2.2-alert-table-bap-department-add-column-finance_code">
		<preConditions onFail="MARK_RAN">
			<not>
				<columnExists tableName="bap_department" columnName="finance_code"/>
			</not>
		</preConditions>
	    <addColumn tableName="bap_department">
		    <column name="finance_code" type="varchar(50)"></column>
	   </addColumn>
	</changeSet>
</databaseChangeLog>