From 4cd9e18cbd7a51e30c6459dd51ec2941722aadf4 Mon Sep 17 00:00:00 2001 From: Preethi G Date: Thu, 12 Sep 2019 10:37:47 -0700 Subject: [PATCH] Added a db-migration script (#69) * 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 --- gateway-ha/pom.xml | 25 ++++++++++++++++--- gateway-ha/src/migrations/database.properties | 4 +++ gateway-ha/src/migrations/gateway-ha.sql | 18 +++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 gateway-ha/src/migrations/database.properties create mode 100644 gateway-ha/src/migrations/gateway-ha.sql diff --git a/gateway-ha/pom.xml b/gateway-ha/pom.xml index e94f8ff4..6c2956a5 100644 --- a/gateway-ha/pom.xml +++ b/gateway-ha/pom.xml @@ -20,8 +20,11 @@ 1.8 1.8 2.7.4 + 2.2 + 8.0.17 UTF-8 UTF-8 + development com.lyft.data.gateway.ha.HaGatewayLauncher @@ -45,7 +48,7 @@ mysql mysql-connector-java - 8.0.17 + ${mysqlconnector.version} @@ -62,7 +65,7 @@ org.javalite activejdbc - 2.2 + ${activejdbc.version} net.sf.ehcache @@ -132,6 +135,22 @@ + + org.javalite + db-migrator-maven-plugin + ${activejdbc.version} + + ${project.basedir}/src/migrations/database.properties + ${environments} + + + + mysql + mysql-connector-java + ${mysqlconnector.version} + + + - + \ No newline at end of file diff --git a/gateway-ha/src/migrations/database.properties b/gateway-ha/src/migrations/database.properties new file mode 100644 index 00000000..e1a799c3 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/gateway-ha/src/migrations/gateway-ha.sql b/gateway-ha/src/migrations/gateway-ha.sql new file mode 100644 index 00000000..8aeed212 --- /dev/null +++ b/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); \ No newline at end of file