when i am trying to drop all objects from a database using Liquibase, its getting error. After running in debug mode i found that its trying to drop sequence after dropping table. So get a error ’ sequence not exists’.
I am running in a schema named “1”, But in public schema it build successfully(not trying to drop sequences).
Here is my ANT target:
<target name="dropAll" depends="prepare" >
<dropAllDatabaseObjects
driver="${db.driver}"
url="${db.url}"
username="${db.username}"
password="${db.password}"
defaultSchemaName="${db.schema}"
promptOnNonLocalDatabase="yes"
classpathref="classpath"
/>
</target>
Here is the log error:
[dropAllDatabaseObjects] Executing EXECUTE database command: DROP TABLE "1"."database_change_log" CASCADE
[dropAllDatabaseObjects] Executing EXECUTE database command: DROP TABLE "1"."database_change_log_lock" CASCADE
[dropAllDatabaseObjects] Executing EXECUTE database command: DROP TABLE "1"."party" CASCADE
[dropAllDatabaseObjects] Executing EXECUTE database command: DROP SEQUENCE "1"."party_id_seq" CASCADE
[dropAllDatabaseObjects] Release Database Lock
[dropAllDatabaseObjects] Executing UPDATE database command: UPDATE "1".databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID =1
[dropAllDatabaseObjects] Successfully released change log lock
BUILD FAILED
D:\Liquibase 3.3.2-ems\common-model\build.xml:90: Unable to drop all objects from database.
at liquibase.integration.ant.DropAllTask.executeWithLiquibaseClassloader(DropAllTask.java:31)
at liquibase.integration.ant.BaseLiquibaseTask.execute(BaseLiquibaseTask.java:82)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: sequence "party_id_seq" does not exist
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:112)
at liquibase.database.AbstractJdbcDatabase.dropDatabaseObjects(AbstractJdbcDatabase.java:753)
at liquibase.Liquibase.dropAll(Liquibase.java:743)
at liquibase.Liquibase.dropAll(Liquibase.java:730)
at liquibase.integration.ant.DropAllTask.executeWithLiquibaseClassloader(DropAllTask.java:28)
... 17 more
Caused by: org.postgresql.util.PSQLException: ERROR: sequence "party_id_seq"does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:397)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
... 24 more