From e28bf8cda48d703c34f8f251a76c6667e8f50394 Mon Sep 17 00:00:00 2001 From: atusa17 Date: Sun, 10 Feb 2019 11:59:33 -0700 Subject: [PATCH] PAN-6 Updated the sql script and created a gradle task to reload the database --- .../persistence/build.gradle | 16 ++++++++++++++++ .../persistence/scripts/mysql/loaddb.sh | 8 ++++++++ .../persistence/sql/local_development.sql | 1 + 3 files changed, 25 insertions(+) create mode 100755 pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh diff --git a/pandamonium-theorem-prover/persistence/build.gradle b/pandamonium-theorem-prover/persistence/build.gradle index b8e0e3f..86db24e 100644 --- a/pandamonium-theorem-prover/persistence/build.gradle +++ b/pandamonium-theorem-prover/persistence/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' } +description = 'Provides database access and connectivity' group 'edu.msudenver.tsp' version '1.0' @@ -14,4 +15,19 @@ repositories { dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile fileTree(dir: 'lib', include: '**/*.jar') + + compile 'com.mchange:c3p0:0.9.5.2' + compile 'mysql:mysql-connector-java:5.1.35' + compile 'org.hibernate:hibernate-validator:5.3.4.Final' + compile 'javax.validation:validation-api:1.1.0.Final' + compile('com.googlecode.log4jdbc:log4jdbc:1.2') { + exclude(group: 'org.slf4j') + } + + testCompile 'javax.el:javax.el-api:3.0.0' +} + +task loadDb(type: Exec, group: 'Verification', description: 'Reloads the local database.') { + workingDir "$rootDir/scripts/mysql" + commandLine './loaddb.sh' } diff --git a/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh b/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh new file mode 100755 index 0000000..53e35ce --- /dev/null +++ b/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +export MYSQL_PWD=secret + +for sqlScript in $( find ../../ -name "*.sql" -print | sort); + do + echo "**** $sqlScript ****" + mysql --batch --quick --raw --line-numbers --force --user=panda < $sqlScript + done \ No newline at end of file diff --git a/pandamonium-theorem-prover/persistence/sql/local_development.sql b/pandamonium-theorem-prover/persistence/sql/local_development.sql index ac034d3..3cdd74a 100644 --- a/pandamonium-theorem-prover/persistence/sql/local_development.sql +++ b/pandamonium-theorem-prover/persistence/sql/local_development.sql @@ -1,3 +1,4 @@ +drop database if exists pandamonium; create database pandamonium; use pandamonium; create table accounts (