Closed Chris3LC closed 8 months ago
@sazonov Could you please review this change?
This is approximately the setup we used to run it (kotlin):
Flyway(
Flyway.configure()
.dataSource(
"jdbc:clickhouse://localhost:9001/", // change port to 9002, 9003, 9004 for the other nodes of the cluster
"admin",
"123"
)
.configuration(mapOf(
"flyway.clickhouse.clusterName" to "'{cluster}'",
// don't put {shard} in the zookeeperPath, to have the change replicated (and visible) on all nodes
"flyway.clickhouse.zookeeperPath" to "/clickhouse/tables/{database}/{table}",
))
.placeholders(mapOf("database" to "the_database"))
.schemas("the_database")
.createSchemas(true)
.failOnMissingLocations(true)
.locations("clickhouse/migrations")
.table("flyway_history")
.baselineVersion("0000")
.baselineOnMigrate(true)
).migrate()
I tested using following docker-compose
cluster: https://github.com/Chris3LC/clickhouse-cluster
@Barry-RG those are critical fixes.
I tried to make the clickhouse community plugin work on our setup, but had to make a few changes:
jdbcTemplate.queryForInt("SELECT COUNT() FROM system.tables WHERE database = ?", name)
. Even though I am not accessingthe_database
, the connection is configured to use it, so I get an exception.clickhouse-jdbc:0.5.0
and newer versions, catalog is used instead of schema (can be overridden using?databaseTerm=schema
in the jdbc-url).Each change is in a separate commit.