使用liquibase使用回滚到mySQL数据库的先前版本的问题

时间:2018-04-02 20:46:28

标签: mysql liquibase

我正在尝试使用liquibase回滚到以前版本的mySQL数据库。我的更改日志文件是

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">


    <changeSet id="1" author="jessica">
        <createTable tableName="student">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="enrolled" type="boolean" defaultValueBoolean="true"/>
        </createTable>
    </changeSet>

    <changeSet id="2" author="jessica">
    <validCheckSum>ANY</validCheckSum>
        <addColumn tableName="student">
            <column name="grade" type="decimal(3,2)" />
        </addColumn>        
    </changeSet>

    <changeSet id="3" author="jessica">
        <dropColumn tableName="student" columnName="enrolled"/>     
    </changeSet>

    <changeSet id="4" author="jessica">
        <tagDatabase tag="version 1.0.0-RELEASE"/>
    </changeSet>

    <changeSet id="6" author="jessica">
        <createTable tableName="instructor">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="start_date" type="date"/>
        </createTable>
    </changeSet>

    <changeSet id="7" author="jessica">
        <validCheckSum>ANY</validCheckSum>
        <tagDatabase tag="version 1.1.0-RELEASE"/>
    </changeSet>

    <changeSet id="8" author="jessica">
        <validCheckSum>ANY</validCheckSum>
        <dropTable tableName="instructor"/>
            <rollback changeSetId="6" changeSetAuthor="jessica"/>
    </changeSet>
</databaseChangeLog>    

我想回滚到“Version 1.0.0 changesetid =”4“是我最初标记的地方.changesetid =”6“是我创建新表的地方。使用我的变更集8我想要回滚(删除教师表) Liquibase说它已经成功更新,但是当我进入mySQL时,表仍然存在。我怎样才能让它回滚?

0 个答案:

没有答案