这是我的情景。
我有一个使用flyway管理我的架构的java应用程序。
我的配置如下所示: 我的flyway build.gradle看起来像:
buildscript {
dependencies {
classpath "org.postgresql:postgresql:42.1.4"
}
}
plugins {
id "org.flywaydb.flyway" version "5.0.7"
}
description = "test-app"
flyway {
url = jdbc:postgresql://localhost:26257/test_dev?sslmode=disable
user = root
password =
}
我在本地主机上以不安全模式运行蟑螂v 2.0。
当我跑步时:
gradle flywayClean
我得到了
Flyway upgrade recommended: CockroachDB 2.0 is newer than this version of Flyway and support
has not been tested.
Unable to clean unknown schema: "test_dev"
当我跑步时:
gradle flywayMigrate
我得到:
Database: jdbc:postgresql://localhost:26257/test_dev (PostgreSQL 9.5)
Flyway upgrade recommended: CockroachDB 2.0 is newer than this version of Flyway and support has not been tested.
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
Creating schema "test_dev" ...
:test-migrations:flywayMigrate (Thread[Task worker for ':',5,main]) completed. Took 19.995 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test-migrations:flywayMigrate'.
> Error occurred while executing flywayMigrate
Unable to create schema "test_dev"
--------------------------------------------------
SQL State : 42P04
Error Code : 0
Message : ERROR: database "test_dev" already exists
ERROR: database "test_dev" already exists
我可以在这里找到什么?
答案 0 :(得分:1)
答案 1 :(得分:1)
有同样的问题,所以我为那些有同样问题的人建造了它。使用它直到5.1版本,这是一个示例gradle文件的片段。
buildscript {
//...
repositories {
//...
maven { url 'https://jitpack.io' }
//...
}
//..
}
plugins {
//...
id "com.radioafricagroup.plugins.flyway" version "0.6.7"
//...
}
此处还有一篇中文帖子,解释了如果感兴趣我如何以及为什么这样做:https://medium.com/radio-africa-techblog/adventures-with-gradle-getting-flyway-to-work-with-cockroachdb-69aabf58cbd4