setup flyway with separate postgres for history info
This commit is contained in:
parent
209696539a
commit
0d8f4c63d4
41
pom.xml
41
pom.xml
@ -50,6 +50,14 @@
|
|||||||
<groupId>org.flywaydb</groupId>
|
<groupId>org.flywaydb</groupId>
|
||||||
<artifactId>flyway-core</artifactId>
|
<artifactId>flyway-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-database-postgresql -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-database-postgresql</artifactId>
|
||||||
|
<version>10.4.1</version>
|
||||||
|
<!-- <scope>runtime</scope> -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.session</groupId>
|
<groupId>org.springframework.session</groupId>
|
||||||
<artifactId>spring-session-core</artifactId>
|
<artifactId>spring-session-core</artifactId>
|
||||||
@ -140,7 +148,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.opencypher/util-9.0 -->
|
<!-- https://mvnrepository.com/artifact/org.opencypher/util-9.0 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.opencypher.gremlin</groupId>
|
<groupId>org.opencypher.gremlin</groupId>
|
||||||
@ -183,6 +190,38 @@
|
|||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-maven-plugin</artifactId>
|
||||||
|
<version>10.17.2</version>
|
||||||
|
<configuration>
|
||||||
|
<sqlMigrationSeparator>__</sqlMigrationSeparator>
|
||||||
|
<locations>
|
||||||
|
<location>filesystem:src/main/resources/db/migration</location>
|
||||||
|
<location>classpath:com/stktrk/app/db/migrations</location>
|
||||||
|
</locations>
|
||||||
|
|
||||||
|
<url>jdbc:postgresql://192.168.178.50:7654/flyway_db</url>
|
||||||
|
<user>flyway_user</user>
|
||||||
|
<password>7e7v55UcYGrY0e3UPYI0qtyMA4YJ1ZkTEaoyZ252GluFkiEMHVT9U5ULS7Rg2rGi</password>
|
||||||
|
<schemas><schema>flyway_db</schema></schemas>
|
||||||
|
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.7.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.stktrk.app.db.migrations;
|
||||||
|
|
||||||
|
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||||
|
import org.flywaydb.core.api.migration.Context;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class V1__CreateTest extends BaseJavaMigration {
|
||||||
|
public void migrate(Context context) throws Exception {
|
||||||
|
|
||||||
|
Class.forName("org.postgresql.Driver");
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.setProperty("user", "root");
|
||||||
|
props.setProperty("password", "playwithdata");
|
||||||
|
props.setProperty("ssl", "false");
|
||||||
|
props.setProperty("sslmode", "disable");
|
||||||
|
|
||||||
|
System.out.println ("migration");
|
||||||
|
|
||||||
|
|
||||||
|
try (Connection connection = DriverManager.getConnection("jdbc:postgresql://192.168.178.50:5432/graph", props)) {
|
||||||
|
|
||||||
|
Statement st = connection.createStatement();
|
||||||
|
st.execute("CREATE VERTEX TYPE test");
|
||||||
|
|
||||||
|
connection.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
System.out.println (e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +1,7 @@
|
|||||||
spring.application.name=app
|
spring.application.name=app
|
||||||
server.port=9090
|
server.port=9090
|
||||||
springdoc.swagger-ui.path=/swagger-ui.html
|
springdoc.swagger-ui.path=/swagger-ui.html
|
||||||
|
|
||||||
|
flyway.user=flyway_user
|
||||||
|
flyway.password=7e7v55UcYGrY0e3UPYI0qtyMA4YJ1ZkTEaoyZ252GluFkiEMHVT9U5ULS7Rg2rGi
|
||||||
|
flyway.schemas=flyway_db
|
||||||
Loading…
Reference in New Issue
Block a user