How can I create tablespace for my Postgres DB dynamically using flyway and java? Trying to create tablespace before executing SQL queries
Flyway flyway = Flyway.configure().dataSource(jdbcTemplate.getDataSource()).baselineOnMigrate(true).locations(migScriptLoc)
.schemas(schemaName).tablespace("test").locations(locations).load();
This gives me below error
enter code hereWrapped by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException:
Migration failed
-----------------
SQL State : 42704
Error Code : 0
Message : ERROR: tablespace "test" does not exist
Location : ()
Line : 1
Statement : CREATE TABLE "master"."flyway_schema_history" (
"installed_rank" INT NOT NULL,
"version" VARCHAR(50),
"description" VARCHAR(200) NOT NULL,
"type" VARCHAR(20) NOT NULL,
"script" VARCHAR(1000) NOT NULL,
"checksum" INTEGER,
"installed_by" VARCHAR(100) NOT NULL,
"installed_on" TIMESTAMP NOT NULL DEFAULT now(),
"execution_time" INTEGER NOT NULL,
"success" BOOLEAN NOT NULL
) TABLESPACE "test"