Liquibase:dropAll没有删除架构 [英] Liquibase:dropAll didn't delete schema

查看:93
本文介绍了Liquibase:dropAll没有删除架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的软件:
Maven 3.0.4
液基:3.0.2
PostgreSQL:9.1.9
JavaSE:1.7.0_25

my software:
Maven 3.0.4
Liquibase: 3.0.2
Postgresql: 9.1.9
JavaSE: 1.7.0_25

我的问题:
我用liquibase创建一些模式

My problem:
I create some schema with liquibase

<changeSet id="create-customermgmt-schema" author="nl">  
   <sql>CREATE SCHEMA "customermgmt";</sql>  
</changeSet>

如果我尝试执行liquibase:dropAll,我会得到:

If i try to exec liquibase:dropAll i get this:

[INFO] Scanning for projects...  
[INFO]                                                                           
[INFO] ------------------------------------------------------------------------    
[INFO] Building akufit.server 0.0.1-SNAPSHOT    
[INFO] ------------------------------------------------------------------------   
[INFO]   
[INFO] --- liquibase-maven-plugin:3.0.2:dropAll (default-cli) @ akufit.server ---   
[INFO] ------------------------------------------------------------------------   
[INFO] Executing on Database: jdbc:postgresql://localhost:5432/akufit   
INFO 8/18/13 5:45 PM:liquibase: Successfully acquired change log lock   
INFO 8/18/13 5:45 PM:liquibase: Dropping Database Objects in schema: akufit.public   
INFO 8/18/13 5:45 PM:liquibase: Creating database history table with name: public.databasechangelog    
INFO 8/18/13 5:45 PM:liquibase: Successfully released change log lock    
INFO 8/18/13 5:45 PM:liquibase: Successfully released change log lock    
[INFO] ------------------------------------------------------------------------   
[INFO]     
[INFO] ------------------------------------------------------------------------   
[INFO] BUILD SUCCESS   
[INFO] ------------------------------------------------------------------------   
[INFO] Total time: 5.978s   
[INFO] Finished at: Sun Aug 18 17:45:54 CEST 2013   
[INFO] Final Memory: 8M/85M     
[INFO] ------------------------------------------------------------------------`   

但是我的模式仍然存在,什么也不会丢失.

but my schema are still there and nothing is droped.

我已验证,所有表和架构都属于liquibase设置中的用户. 如果您需要更多信息,请写信.

I verified, that all tables and schemas belong to the user in the liquibase settings. If you need more information, please write.

也许您可以帮助我.谢谢.

Maybe you can help me. Thanks.

pom.xml:

<plugin>   
    <groupId>org.liquibase</groupId>   
    <artifactId>liquibase-maven-plugin</artifactId>   
    <version>3.0.2</version>   
    <configuration>   
        <changeLogFile>src/main/resources/db-changelog.xml</changeLogFile>   
    <driver>org.postgresql.Driver</driver>   
    <url>jdbc:postgresql://localhost:5432/akufit</url>   
    <username>***</username>   
    <password>***</password>   
    </configuration>   
    <dependencies>   
        <dependency>   
        <groupId>postgresql</groupId>   
        <artifactId>postgresql</artifactId>   
        <version>9.0-801.jdbc4</version>   
    </dependency>   
    </dependencies>   
</plugin>

推荐答案

@Mark O'Connor写的是100%正确的.如果以编程方式将Schema放在LiquiBase changelog表所在的位置,则会出现以下错误:

What @Mark O'Connor wrote is 100% right. If you programmatorically drop the Schema where the LiquiBase changelog tables are, you will get the following error:

SEVERE 5/02/14 10:26:liquibase: liquibase/db.dropschema.changelog.xml::dropschema-1::debacked: Could not release lock

这是因为您还删除了LiquiBase更新日志表.

This is because you dropped also the LiquiBase changelog tables.

您可以通过设置参数轻松解决此问题liquibase.changelogSchemaName .这样,LiquiBase Changelog表具有其自己的模式.

You can easily solve this by setting the parameter liquibase.changelogSchemaName. That way the LiquiBase Changelog tables have their own schema.

顺便说一句,我总是设置此参数,这样LiquiBase Changelog表不会使您的Schema混乱,因为它们没有任何业务价值...

By the way, I always set this parameter, that way the LiquiBase Changelog tables do not clutter up your Schema, as they do not have any business value...

这篇关于Liquibase:dropAll没有删除架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆