Skip to content

Commit

Permalink
Added a db-migration script (#69)
Browse files Browse the repository at this point in the history
* Removed OSCache. Using EHCache and Guava instead. (#67)

* Gateway HA implementation

* perf: Utilize EHCache and Guava cache only

* fix: changes after review

* docs: update gateway-ha README.md

* fix: updated after review

* fix: replaced cacheDir with gatewayStateDir

* Removed OSCache. Using EHCache and Guava instead. (#67)

* Gateway HA implementation

* perf: Utilize EHCache and Guava cache only

* fix: changes after review

* docs: update gateway-ha README.md

* fix: updated after review

* fix: replaced cacheDir with gatewayStateDir

* feat: Added db migration script

* fix: removed db-migrator-plugin from validate phase
  • Loading branch information
Preethi G authored and puneetjaiswal committed Sep 12, 2019
1 parent 0c52b95 commit 4cd9e18
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
25 changes: 22 additions & 3 deletions gateway-ha/pom.xml
Expand Up @@ -20,8 +20,11 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<ehcache.version>2.7.4</ehcache.version>
<activejdbc.version>2.2</activejdbc.version>
<mysqlconnector.version>8.0.17</mysqlconnector.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<environments>development</environments>
<app.main.class>com.lyft.data.gateway.ha.HaGatewayLauncher</app.main.class>
</properties>

Expand All @@ -45,7 +48,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
<version>${mysqlconnector.version}</version>
</dependency>
<!-- Test deps -->
<dependency>
Expand All @@ -62,7 +65,7 @@
<dependency>
<groupId>org.javalite</groupId>
<artifactId>activejdbc</artifactId>
<version>2.2</version>
<version>${activejdbc.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
Expand Down Expand Up @@ -132,6 +135,22 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.javalite</groupId>
<artifactId>db-migrator-maven-plugin</artifactId>
<version>${activejdbc.version}</version>
<configuration>
<configFile>${project.basedir}/src/migrations/database.properties</configFile>
<environments>${environments}</environments>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysqlconnector.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
</project>
4 changes: 4 additions & 0 deletions gateway-ha/src/migrations/database.properties
@@ -0,0 +1,4 @@
development.driver=com.mysql.cj.jdbc.Driver
development.username=root
development.password=root123
development.url=jdbc:mysql://127.0.0.1:3306/prestogateway
18 changes: 18 additions & 0 deletions gateway-ha/src/migrations/gateway-ha.sql
@@ -0,0 +1,18 @@
CREATE DATABASE prestogateway;

CREATE TABLE IF NOT EXISTS gateway_backend (
name VARCHAR(256) PRIMARY KEY,
routing_group VARCHAR (256),
backend_url VARCHAR (256),
active BOOLEAN
);

CREATE TABLE IF NOT EXISTS query_history (
query_id VARCHAR(256) PRIMARY KEY,
query_text VARCHAR (256),
created bigint,
backend_url VARCHAR (256),
user_name VARCHAR(256),
source VARCHAR(256)
);
CREATE INDEX query_history_created_idx ON query_history(created);

0 comments on commit 4cd9e18

Please sign in to comment.