PAN-6 Updated the sql script and created a gradle task to reload the database

This commit is contained in:
2019-02-10 11:59:33 -07:00
parent 89af852ec8
commit e28bf8cda4
3 changed files with 25 additions and 0 deletions
@@ -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'
}
@@ -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
@@ -1,3 +1,4 @@
drop database if exists pandamonium;
create database pandamonium;
use pandamonium;
create table accounts (