added base V and E types
This commit is contained in:
parent
c5f37a9b5b
commit
43473ebffc
@ -1,5 +1,8 @@
|
||||
package com.stktrk.auth.integration.flyway;
|
||||
|
||||
import com.arcadedb.database.Database;
|
||||
import com.arcadedb.database.DatabaseFactory;
|
||||
import com.arcadedb.event.BeforeRecordCreateListener;
|
||||
import com.arcadedb.gremlin.ArcadeGraph;
|
||||
import com.arcadedb.gremlin.ArcadeGraphFactory;
|
||||
import com.stktrk.auth.integration.configuration.types.GraphDbConfig;
|
||||
@ -9,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* provides connection pool for arcade DB
|
||||
@ -27,16 +32,17 @@ public class ConnectionPool {
|
||||
*/
|
||||
@PostConstruct
|
||||
void init() {
|
||||
pool = ArcadeGraphFactory.withRemote(graphDbConfig.getHost(),
|
||||
graphDbConfig.getHttpPort(),
|
||||
graphDbConfig.getGraphName(),
|
||||
graphDbConfig.getUser(),
|
||||
graphDbConfig.getPassword());
|
||||
pool = ArcadeGraphFactory.withRemote(graphDbConfig.getHost(),
|
||||
graphDbConfig.getHttpPort(),
|
||||
graphDbConfig.getGraphName(),
|
||||
graphDbConfig.getUser(),
|
||||
graphDbConfig.getPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DB connection from pool
|
||||
* @return graphFactory to run queries against
|
||||
*
|
||||
* @return graphFactory to run queries against
|
||||
*/
|
||||
@Nonnull
|
||||
public static ArcadeGraph getGraph() {
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.stktrk.auth.integration.flyway.migrations;
|
||||
|
||||
import com.stktrk.auth.integration.configuration.types.GraphDbConfig;
|
||||
import com.stktrk.auth.integration.flyway.MigrationWrapper;
|
||||
import jakarta.annotation.Nonnull;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Component
|
||||
@Value
|
||||
public class V3__427__BaseTypes extends BaseJavaMigration implements MigrationWrapper {
|
||||
@Nonnull
|
||||
@Autowired
|
||||
GraphDbConfig graphDbConfig;
|
||||
|
||||
public void migrate(@Nonnull Context context) throws Exception {
|
||||
this.executeQuery(graphDbConfig,"CREATE VERTEX TYPE V IF NOT EXISTS; CREATE PROPERTY V.createdOn DATETIME (MANDATORY true, notnull true); CREATE PROPERTY V.createdBy STRING (MANDATORY true); CREATE PROPERTY V.changedOn DATETIME; CREATE PROPERTY V.changedBy STRING; CREATE EDGE TYPE E IF NOT EXISTS; CREATE PROPERTY E.createdOn DATETIME (MANDATORY true, notnull true); CREATE PROPERTY E.createdBy STRING (MANDATORY true); CREATE PROPERTY E.changedOn DATETIME; CREATE PROPERTY E.changedBy STRING; ALTER TYPE Account SUPERTYPE +V; Alter Type Role SUPERTYPE +V; Alter Type hasRole SUPERTYPE +E");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user