diff --git a/build.gradle b/build.gradle
index 8450388e1..edc1c4b45 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.9.RELEASE")
+ classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.17")
}
}
@@ -36,10 +36,13 @@ test {
}
dependencies {
+ runtimeOnly("org.springframework.boot:spring-boot-properties-migrator")
+
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-test")
compile("org.springframework.boot:spring-boot-starter-mail")
+ compile("org.springframework.boot:spring-boot-starter-validation")
compile("org.springframework.ldap:spring-ldap-ldif-core:2.3.2.RELEASE")
compile("io.jsonwebtoken:jjwt:0.9.0")
compile("commons-io:commons-io:2.6")
@@ -53,7 +56,7 @@ dependencies {
compile("org.slf4j:slf4j-api:1.7.25")
compile("org.apache.commons:commons-lang3:3.7")
compile("javax.mail:mail:1.4.7")
- compile("org.flywaydb:flyway-core:5.0.7")
+ compile("org.flywaydb:flyway-core:7.7.3")
compile("org.apache.httpcomponents:httpclient:4.5.9")
compile("org.javers:javers-core:2.4.1")
compile("javax.xml.bind:jaxb-api:2.3.1")
diff --git a/checkstyle.xml b/checkstyle.xml
index 3e732dd5d..f857d9b2b 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -26,6 +26,10 @@
+
+
+
+
@@ -41,10 +45,6 @@
-
-
-
-
@@ -233,11 +233,8 @@
-
-
-
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 87b738cbd..e708b1c02 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 6b3851a8a..549d84424 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index af6708ff2..4f906e0c8 100755
--- a/gradlew
+++ b/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m"'
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 0f8d5937c..ac1b06f93 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m"
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/src/main/java/db/migration/V112__Copies_Courses_metadata_to_CourseOfferingGroup.java b/src/main/java/db/migration/V112__Copies_Courses_metadata_to_CourseOfferingGroup.java
index 7b2e83746..00987e188 100644
--- a/src/main/java/db/migration/V112__Copies_Courses_metadata_to_CourseOfferingGroup.java
+++ b/src/main/java/db/migration/V112__Copies_Courses_metadata_to_CourseOfferingGroup.java
@@ -1,16 +1,19 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V112__Copies_Courses_metadata_to_CourseOfferingGroup implements JdbcMigration {
+public class V112__Copies_Courses_metadata_to_CourseOfferingGroup extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Add required metadata columns to CourseOfferingGroups
PreparedStatement psAddMetadataColumns = connection.prepareStatement(
" ALTER TABLE `CourseOfferingGroups`" +
diff --git a/src/main/java/db/migration/V113__Copies_CourseOfferings_metadata_to_SectionGroups.java b/src/main/java/db/migration/V113__Copies_CourseOfferings_metadata_to_SectionGroups.java
index 49f948206..5634f73e8 100644
--- a/src/main/java/db/migration/V113__Copies_CourseOfferings_metadata_to_SectionGroups.java
+++ b/src/main/java/db/migration/V113__Copies_CourseOfferings_metadata_to_SectionGroups.java
@@ -1,16 +1,19 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V113__Copies_CourseOfferings_metadata_to_SectionGroups implements JdbcMigration {
+public class V113__Copies_CourseOfferings_metadata_to_SectionGroups extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Add required metadata columns to SectionGroups
PreparedStatement psAddMetadataColumns = connection.prepareStatement(
" ALTER TABLE `SectionGroups`" +
diff --git a/src/main/java/db/migration/V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments.java b/src/main/java/db/migration/V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments.java
index 3ff060146..f1346a23c 100644
--- a/src/main/java/db/migration/V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments.java
+++ b/src/main/java/db/migration/V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments.java
@@ -1,20 +1,23 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import org.flywaydb.core.api.migration.Context;
/**
* Created by Lloyd on 6/15/16.
*/
-public class V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments implements JdbcMigration {
+public class V114__Copies_TeachingPreferences_metadata_To_TeachingAssignments extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) {
+ public void migrate(Context context) {
+ Connection connection = context.getConnection();
+
PreparedStatement psAllTeachingAssignments = null;
PreparedStatement psAddMetadataColumns = null;
diff --git a/src/main/java/db/migration/V116__Split_Courses_With_More_Than_One_Sequence_Pattern.java b/src/main/java/db/migration/V116__Split_Courses_With_More_Than_One_Sequence_Pattern.java
index 155f962c2..35ce24400 100644
--- a/src/main/java/db/migration/V116__Split_Courses_With_More_Than_One_Sequence_Pattern.java
+++ b/src/main/java/db/migration/V116__Split_Courses_With_More_Than_One_Sequence_Pattern.java
@@ -1,23 +1,26 @@
package db.migration;
import org.apache.commons.lang3.math.NumberUtils;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
+import org.flywaydb.core.api.migration.Context;
/**
* Created by okadri on 6/16/16.
*/
-public class V116__Split_Courses_With_More_Than_One_Sequence_Pattern implements JdbcMigration {
+public class V116__Split_Courses_With_More_Than_One_Sequence_Pattern extends BaseJavaMigration {
public boolean isNumeric(String s) {
return s.matches("[-+]?\\d*\\.?\\d+");
}
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psAllCourses = null;
try {
diff --git a/src/main/java/db/migration/V128__Merge_Shared_Activities_And_Set_SectionGroupId.java b/src/main/java/db/migration/V128__Merge_Shared_Activities_And_Set_SectionGroupId.java
index c808cd4b7..859a06622 100644
--- a/src/main/java/db/migration/V128__Merge_Shared_Activities_And_Set_SectionGroupId.java
+++ b/src/main/java/db/migration/V128__Merge_Shared_Activities_And_Set_SectionGroupId.java
@@ -1,18 +1,21 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
+import org.flywaydb.core.api.migration.Context;
/**
* Created by okadri on 8/30/16.
*/
-public class V128__Merge_Shared_Activities_And_Set_SectionGroupId implements JdbcMigration {
+public class V128__Merge_Shared_Activities_And_Set_SectionGroupId extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psSectionGroupsWithSharedActivities = null;
try {
diff --git a/src/main/java/db/migration/V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses.java b/src/main/java/db/migration/V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses.java
index d7a2ccc8c..0d9c131c5 100644
--- a/src/main/java/db/migration/V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses.java
+++ b/src/main/java/db/migration/V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses.java
@@ -1,13 +1,16 @@
package db.migration;
- import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+ import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
+ import org.flywaydb.core.api.migration.Context;
-public class V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses implements JdbcMigration {
+public class V142__Migrate_Data_From_TeachingCalls_To_Receipts_and_Responses extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psTeachingCalls = connection.prepareStatement("SELECT * FROM `TeachingCalls`");
try {
diff --git a/src/main/java/db/migration/V144__Merge_Duplicate_Courses.java b/src/main/java/db/migration/V144__Merge_Duplicate_Courses.java
index 45d526971..6af5bc326 100644
--- a/src/main/java/db/migration/V144__Merge_Duplicate_Courses.java
+++ b/src/main/java/db/migration/V144__Merge_Duplicate_Courses.java
@@ -1,15 +1,18 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
+import org.flywaydb.core.api.migration.Context;
-public class V144__Merge_Duplicate_Courses implements JdbcMigration {
+public class V144__Merge_Duplicate_Courses extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psCourses = connection.prepareStatement("SELECT * FROM `Courses`");
List courseIdsAlreadyProcessed = new ArrayList<>();
diff --git a/src/main/java/db/migration/V148__Migrate_Teaching_Assistant_UserRoles.java b/src/main/java/db/migration/V148__Migrate_Teaching_Assistant_UserRoles.java
index 1f0ba40d8..53cedf384 100644
--- a/src/main/java/db/migration/V148__Migrate_Teaching_Assistant_UserRoles.java
+++ b/src/main/java/db/migration/V148__Migrate_Teaching_Assistant_UserRoles.java
@@ -1,10 +1,13 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
+import org.flywaydb.core.api.migration.Context;
-public class V148__Migrate_Teaching_Assistant_UserRoles implements JdbcMigration {
+public class V148__Migrate_Teaching_Assistant_UserRoles extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psUserRoles = connection.prepareStatement("SELECT * FROM `UserRoles` WHERE `RoleId` = ? OR `RoleId` = ?;");
psUserRoles.setLong(1, 6L);
psUserRoles.setLong(2, 7L);
diff --git a/src/main/java/db/migration/V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup.java b/src/main/java/db/migration/V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup.java
index c8f292235..8ae9eb24e 100644
--- a/src/main/java/db/migration/V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup.java
+++ b/src/main/java/db/migration/V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup.java
@@ -1,14 +1,17 @@
package db.migration;
import edu.ucdavis.dss.ipa.api.helpers.Utilities;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
+import org.flywaydb.core.api.migration.Context;
-public class V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup implements JdbcMigration {
+public class V166__Ensure_Activities_Of_Numeric_SectionGroups_Are_Associated_To_SectionGroup extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Find all activities
// Is the activity associated to a section?
// If the section has a numeric sequenceNumber, add a sectionGroup association and remove the section association
diff --git a/src/main/java/db/migration/V171__Ensure_Activity_frequency_is_not_zero.java b/src/main/java/db/migration/V171__Ensure_Activity_frequency_is_not_zero.java
index e2a78c828..dd0730ca1 100644
--- a/src/main/java/db/migration/V171__Ensure_Activity_frequency_is_not_zero.java
+++ b/src/main/java/db/migration/V171__Ensure_Activity_frequency_is_not_zero.java
@@ -1,14 +1,17 @@
package db.migration;
import edu.ucdavis.dss.ipa.api.helpers.Utilities;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
+import org.flywaydb.core.api.migration.Context;
-public class V171__Ensure_Activity_frequency_is_not_zero implements JdbcMigration {
+public class V171__Ensure_Activity_frequency_is_not_zero extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Find all activities
PreparedStatement psActivities = connection.prepareStatement("SELECT * FROM `Activities`");
diff --git a/src/main/java/db/migration/V173__Ensure_Activity_Duration_is_not_zero.java b/src/main/java/db/migration/V173__Ensure_Activity_Duration_is_not_zero.java
index 9d23178d5..b295ae344 100644
--- a/src/main/java/db/migration/V173__Ensure_Activity_Duration_is_not_zero.java
+++ b/src/main/java/db/migration/V173__Ensure_Activity_Duration_is_not_zero.java
@@ -1,16 +1,19 @@
package db.migration;
import edu.ucdavis.dss.ipa.api.helpers.Utilities;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.*;
import java.util.Calendar;
import java.util.Date;
+import org.flywaydb.core.api.migration.Context;
-public class V173__Ensure_Activity_Duration_is_not_zero implements JdbcMigration {
+public class V173__Ensure_Activity_Duration_is_not_zero extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Find all activities
PreparedStatement psActivities = connection.prepareStatement("SELECT * FROM `Activities`");
diff --git a/src/main/java/db/migration/V188__Remove_persist_lineItems_that_should_be_implicit.java b/src/main/java/db/migration/V188__Remove_persist_lineItems_that_should_be_implicit.java
index 761d4efba..f01c9e44a 100644
--- a/src/main/java/db/migration/V188__Remove_persist_lineItems_that_should_be_implicit.java
+++ b/src/main/java/db/migration/V188__Remove_persist_lineItems_that_should_be_implicit.java
@@ -1,14 +1,17 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.math.BigDecimal;
import java.sql.*;
+import org.flywaydb.core.api.migration.Context;
-public class V188__Remove_persist_lineItems_that_should_be_implicit implements JdbcMigration {
+public class V188__Remove_persist_lineItems_that_should_be_implicit extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Find all lineItems
PreparedStatement psLineItems = connection.prepareStatement("SELECT * FROM `LineItems`");
diff --git a/src/main/java/db/migration/V192__Assign_Instructor_Types.java b/src/main/java/db/migration/V192__Assign_Instructor_Types.java
index 84d99bc8b..a170de00f 100644
--- a/src/main/java/db/migration/V192__Assign_Instructor_Types.java
+++ b/src/main/java/db/migration/V192__Assign_Instructor_Types.java
@@ -1,13 +1,14 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
+import org.flywaydb.core.api.migration.Context;
-public class V192__Assign_Instructor_Types implements JdbcMigration {
+public class V192__Assign_Instructor_Types extends BaseJavaMigration {
static Long INSTRUCTOR_ROLE = 15L;
// Instructor Types
@@ -24,11 +25,13 @@ public class V192__Assign_Instructor_Types implements JdbcMigration {
* Will also delete instructorTypeCosts with no amount set.
* This is in preparation for dropping the description column and making instructorTypeCosts optional.
*
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psInstructorTypeCosts = connection.prepareStatement("SELECT * FROM `InstructorTypeCosts`");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V194__Migrate_instructor_userRoles.java b/src/main/java/db/migration/V194__Migrate_instructor_userRoles.java
index 815ea4070..33f094832 100644
--- a/src/main/java/db/migration/V194__Migrate_instructor_userRoles.java
+++ b/src/main/java/db/migration/V194__Migrate_instructor_userRoles.java
@@ -1,6 +1,6 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -9,8 +9,9 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
+import org.flywaydb.core.api.migration.Context;
-public class V194__Migrate_instructor_userRoles implements JdbcMigration {
+public class V194__Migrate_instructor_userRoles extends BaseJavaMigration {
// Instructor Roles
public static final int SENATE_INSTRUCTOR_ROLE = 1;
public static final int FEDERATION_INSTRUCTOR_ROLE = 8;
@@ -26,11 +27,13 @@ public class V194__Migrate_instructor_userRoles implements JdbcMigration {
/**
* Converts any 'instructor'-ish userRoles into an instructor role with a relevant instructorType
*
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psUsers = connection.prepareStatement("SELECT * FROM `Users`");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V198__Migrate_TeachingAssignments_To_InstructorType.java b/src/main/java/db/migration/V198__Migrate_TeachingAssignments_To_InstructorType.java
index e03c41ddb..576dfb848 100644
--- a/src/main/java/db/migration/V198__Migrate_TeachingAssignments_To_InstructorType.java
+++ b/src/main/java/db/migration/V198__Migrate_TeachingAssignments_To_InstructorType.java
@@ -1,22 +1,25 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V198__Migrate_TeachingAssignments_To_InstructorType implements JdbcMigration {
+public class V198__Migrate_TeachingAssignments_To_InstructorType extends BaseJavaMigration {
// Instructor Types
public static final long INSTRUCTOR = 7L;
/**
* Calculate instructorTypes for pre-existing teachingAssignments.
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psTeachingAssignments = connection.prepareStatement("SELECT * FROM `TeachingAssignments`");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V199__Migrate_AI_placeholder_To_TeachingAssignment.java b/src/main/java/db/migration/V199__Migrate_AI_placeholder_To_TeachingAssignment.java
index 619d05bfc..6a38a9cd1 100644
--- a/src/main/java/db/migration/V199__Migrate_AI_placeholder_To_TeachingAssignment.java
+++ b/src/main/java/db/migration/V199__Migrate_AI_placeholder_To_TeachingAssignment.java
@@ -1,21 +1,24 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V199__Migrate_AI_placeholder_To_TeachingAssignment implements JdbcMigration {
+public class V199__Migrate_AI_placeholder_To_TeachingAssignment extends BaseJavaMigration {
static Long ASSOCIATE_INSTRUCTOR = 3L;
/**
* Migrates AI placeholders into new teachingAssignments with instructorType 'AI'
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psSectionGroups = connection.prepareStatement("SELECT * FROM SectionGroups WHERE ShowPlaceholderAI = 1");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V204__Fix_numeric_activities.java b/src/main/java/db/migration/V204__Fix_numeric_activities.java
index 67142ab95..81fa715bd 100644
--- a/src/main/java/db/migration/V204__Fix_numeric_activities.java
+++ b/src/main/java/db/migration/V204__Fix_numeric_activities.java
@@ -1,21 +1,24 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V204__Fix_numeric_activities implements JdbcMigration {
+public class V204__Fix_numeric_activities extends BaseJavaMigration {
/**
* Identify activities that are inappropriately connected to sections that are numeric,
* And connect them instead to the parent sectionGroup
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psActivities = connection.prepareStatement("SELECT a.Id, s.sectionGroupId FROM Sections s, Activities a WHERE s.SequenceNumber > 0 AND a.SectionId IS NOT NULL AND a.sectionId = s.Id;");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V208__Persist_Implicit_SectionGroupCosts.java b/src/main/java/db/migration/V208__Persist_Implicit_SectionGroupCosts.java
index 221de3d0a..ab22b9ed2 100644
--- a/src/main/java/db/migration/V208__Persist_Implicit_SectionGroupCosts.java
+++ b/src/main/java/db/migration/V208__Persist_Implicit_SectionGroupCosts.java
@@ -1,22 +1,25 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V208__Persist_Implicit_SectionGroupCosts implements JdbcMigration {
+public class V208__Persist_Implicit_SectionGroupCosts extends BaseJavaMigration {
/**
* Currently, budgetScenarios would only persist sectionGroupCosts when a user wants to override a value from the schedule,
* And the sectionGroupCost would only store override values, null indicating no override.
* This migration will ensure that all sectionGroups have a corresponding sectionGroupCost and that any null fields are updated to store a snapshot of the current value
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// For each sectionGroup
// For each budgetScenario in the same schedule as the sectionGroup
// Query for a sectionGroupCost that matches the sectionGroupId and budgetScenarioId
diff --git a/src/main/java/db/migration/V210__Migrate_Course_Data_onto_SectionGroupCosts.java b/src/main/java/db/migration/V210__Migrate_Course_Data_onto_SectionGroupCosts.java
index 826ff98d6..27c48d3d1 100644
--- a/src/main/java/db/migration/V210__Migrate_Course_Data_onto_SectionGroupCosts.java
+++ b/src/main/java/db/migration/V210__Migrate_Course_Data_onto_SectionGroupCosts.java
@@ -1,21 +1,24 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V210__Migrate_Course_Data_onto_SectionGroupCosts implements JdbcMigration {
+public class V210__Migrate_Course_Data_onto_SectionGroupCosts extends BaseJavaMigration {
/**
* Fills in the new fields on sectionGroupCosts to ensure they can continue to display properly,
* Even if the course/sectionGroup they were created from is deleted
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psSectionGroupCosts = connection.prepareStatement("SELECT * FROM SectionGroupCosts;");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V214__Fix_incorrectly_separated_sharedActivities.java b/src/main/java/db/migration/V214__Fix_incorrectly_separated_sharedActivities.java
index e4d5ab64f..644d0de20 100644
--- a/src/main/java/db/migration/V214__Fix_incorrectly_separated_sharedActivities.java
+++ b/src/main/java/db/migration/V214__Fix_incorrectly_separated_sharedActivities.java
@@ -1,6 +1,7 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
import org.joda.time.DateTime;
import java.sql.Connection;
@@ -13,15 +14,17 @@
import java.util.List;
import java.util.Map;
-public class V214__Fix_incorrectly_separated_sharedActivities implements JdbcMigration {
+public class V214__Fix_incorrectly_separated_sharedActivities extends BaseJavaMigration {
/**
* Refactors repeated activities within a sectionGroup into a single shared activity
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Look through all letter based sectionGroups
// If each section has an activity that matches on day/start/end/type, delete those sections and create a sharedActivity with those options
// use a hashmap of occurences, and a hashmap of matching activity ids
diff --git a/src/main/java/db/migration/V217__Fix_sectionGroupCost_units.java b/src/main/java/db/migration/V217__Fix_sectionGroupCost_units.java
index 35315877e..f069aa7ab 100644
--- a/src/main/java/db/migration/V217__Fix_sectionGroupCost_units.java
+++ b/src/main/java/db/migration/V217__Fix_sectionGroupCost_units.java
@@ -1,20 +1,22 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V217__Fix_sectionGroupCost_units implements JdbcMigration {
+public class V217__Fix_sectionGroupCost_units extends BaseJavaMigration {
/**
* Fixes sectionGroupCosts that were in-correctly created without units
- * @param connection
+ * @param context
* @throws Exception
*/
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
PreparedStatement psSectionGroupCosts = connection.prepareStatement("SELECT * FROM SectionGroupCosts WHERE UnitsHigh IS NULL AND UnitsLow IS NULL;");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V219__Combine_staff_notes.java b/src/main/java/db/migration/V219__Combine_staff_notes.java
index 4c8f4aacb..ef33c7086 100644
--- a/src/main/java/db/migration/V219__Combine_staff_notes.java
+++ b/src/main/java/db/migration/V219__Combine_staff_notes.java
@@ -1,14 +1,17 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V219__Combine_staff_notes implements JdbcMigration {
+public class V219__Combine_staff_notes extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psInstructorNotes = connection.prepareStatement("SELECT * FROM InstructorNotes;");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data.java b/src/main/java/db/migration/V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data.java
index 348450f04..2abbd6a17 100644
--- a/src/main/java/db/migration/V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data.java
+++ b/src/main/java/db/migration/V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data.java
@@ -1,14 +1,17 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data implements JdbcMigration {
+public class V225__Update_SectionGroupCosts_instructorTypes_to_userRole_data extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement psSectionGroupCosts = connection.prepareStatement("SELECT * FROM SectionGroupCosts WHERE InstructorId IS NOT NULL;");
connection.setAutoCommit(false);
diff --git a/src/main/java/db/migration/V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments.java b/src/main/java/db/migration/V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments.java
index bce35f11b..567a6dbc2 100644
--- a/src/main/java/db/migration/V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments.java
+++ b/src/main/java/db/migration/V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments.java
@@ -1,14 +1,17 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import org.flywaydb.core.api.migration.Context;
-public class V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments implements JdbcMigration {
+public class V227__Migrate_TeachingCallReceipts_Comments_To_TeachingCallComments extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Create TeachingCallComments table
String createTeachingCallComments = "CREATE TABLE IF NOT EXISTS `TeachingCallComments` ("
+ "`Id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,"
diff --git a/src/main/java/db/migration/V232__Add_TermCode_To_StudentSupportPreferences.java b/src/main/java/db/migration/V232__Add_TermCode_To_StudentSupportPreferences.java
index 1bf297012..7cc5910e4 100644
--- a/src/main/java/db/migration/V232__Add_TermCode_To_StudentSupportPreferences.java
+++ b/src/main/java/db/migration/V232__Add_TermCode_To_StudentSupportPreferences.java
@@ -3,11 +3,14 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V232__Add_TermCode_To_StudentSupportPreferences implements JdbcMigration {
+public class V232__Add_TermCode_To_StudentSupportPreferences extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Add TermCode to track when Preference was created
PreparedStatement psAddTermCodeColumnToStudentSupportPreferences =
connection.prepareStatement(
diff --git a/src/main/java/db/migration/V237__Create_SectionGroupCostInstructorsTable.java b/src/main/java/db/migration/V237__Create_SectionGroupCostInstructorsTable.java
index a2019510a..89bdfb10a 100644
--- a/src/main/java/db/migration/V237__Create_SectionGroupCostInstructorsTable.java
+++ b/src/main/java/db/migration/V237__Create_SectionGroupCostInstructorsTable.java
@@ -1,6 +1,6 @@
package db.migration;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
import java.math.BigDecimal;
import java.sql.Connection;
@@ -10,10 +10,13 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.flywaydb.core.api.migration.Context;
-public class V237__Create_SectionGroupCostInstructorsTable implements JdbcMigration {
+public class V237__Create_SectionGroupCostInstructorsTable extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
connection.setAutoCommit(false);
try {
// Extend Reason Size on SectionGroupCost Table
diff --git a/src/main/java/db/migration/V69__Move_SG_Details_To_COG.java b/src/main/java/db/migration/V69__Move_SG_Details_To_COG.java
index edeef6ac4..35c8ed662 100644
--- a/src/main/java/db/migration/V69__Move_SG_Details_To_COG.java
+++ b/src/main/java/db/migration/V69__Move_SG_Details_To_COG.java
@@ -4,12 +4,15 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V69__Move_SG_Details_To_COG implements JdbcMigration {
+public class V69__Move_SG_Details_To_COG extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
PreparedStatement statement0 = connection.prepareStatement("SELECT cogs.* FROM `CourseOfferingGroups` cogs");
try {
diff --git a/src/main/java/db/migration/V73__Create_CourseOfferingId_In_SectionGroups.java b/src/main/java/db/migration/V73__Create_CourseOfferingId_In_SectionGroups.java
index 5153a0bf8..d58059d4a 100644
--- a/src/main/java/db/migration/V73__Create_CourseOfferingId_In_SectionGroups.java
+++ b/src/main/java/db/migration/V73__Create_CourseOfferingId_In_SectionGroups.java
@@ -5,13 +5,16 @@
import java.sql.ResultSet;
import java.sql.Statement;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V73__Create_CourseOfferingId_In_SectionGroups implements JdbcMigration {
+public class V73__Create_CourseOfferingId_In_SectionGroups extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
String createColumnQuery = "ALTER TABLE `SectionGroups`"
+ " ADD COLUMN `CourseOfferings_CourseOfferingId` INT(11) NULL";
PreparedStatement createColumnStatement = connection.prepareStatement(createColumnQuery);
diff --git a/src/main/java/db/migration/V7__Make_EmployeeId_Unique.java b/src/main/java/db/migration/V7__Make_EmployeeId_Unique.java
index 9ee587429..4633540e0 100644
--- a/src/main/java/db/migration/V7__Make_EmployeeId_Unique.java
+++ b/src/main/java/db/migration/V7__Make_EmployeeId_Unique.java
@@ -4,12 +4,15 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V7__Make_EmployeeId_Unique implements JdbcMigration {
+public class V7__Make_EmployeeId_Unique extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
String duplicates = "SELECT DISTINCT(i1.`InstructorId`), i1.`EmployeeId`"
+ " FROM `Instructors` i1, `Instructors` i2"
+ " WHERE i1.`InstructorId` > i2.`InstructorId`"
diff --git a/src/main/java/db/migration/V82__Update_CO_Seat_Counts.java b/src/main/java/db/migration/V82__Update_CO_Seat_Counts.java
index effd04312..e48dc00dd 100644
--- a/src/main/java/db/migration/V82__Update_CO_Seat_Counts.java
+++ b/src/main/java/db/migration/V82__Update_CO_Seat_Counts.java
@@ -4,12 +4,15 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V82__Update_CO_Seat_Counts implements JdbcMigration {
+public class V82__Update_CO_Seat_Counts extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Loop over all COs ...
PreparedStatement fetchCOsStatement = connection.prepareStatement("SELECT CourseOfferingId FROM CourseOfferings");
ResultSet rsFetchCos = fetchCOsStatement.executeQuery();
diff --git a/src/main/java/db/migration/V87__Create_CourseOfferingId_In_TeachingPreferences.java b/src/main/java/db/migration/V87__Create_CourseOfferingId_In_TeachingPreferences.java
index 1ac1cf1fe..6c23d95ab 100644
--- a/src/main/java/db/migration/V87__Create_CourseOfferingId_In_TeachingPreferences.java
+++ b/src/main/java/db/migration/V87__Create_CourseOfferingId_In_TeachingPreferences.java
@@ -4,13 +4,16 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V87__Create_CourseOfferingId_In_TeachingPreferences implements JdbcMigration {
+public class V87__Create_CourseOfferingId_In_TeachingPreferences extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
String createColumnQuery = "ALTER TABLE `TeachingPreferences`"
+ " ADD COLUMN `CourseOfferings_CourseOfferingId` INT(11) NULL";
PreparedStatement createColumnStatement = connection.prepareStatement(createColumnQuery);
diff --git a/src/main/java/db/migration/V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts.java b/src/main/java/db/migration/V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts.java
index 857a1caf4..a5b7b42ef 100644
--- a/src/main/java/db/migration/V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts.java
+++ b/src/main/java/db/migration/V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts.java
@@ -4,13 +4,16 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts implements JdbcMigration {
+public class V95__Move_Comment_From_TeachingCallResponses_To_TeachingCallReceipts extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
+
// Add the Comment column to TeachingCallReceipts
String createColumnQuery = "ALTER TABLE `TeachingCallReceipts`"
+ " ADD COLUMN `Comment` TEXT NULL DEFAULT NULL;";
diff --git a/src/main/java/db/migration/V9__Create_CourseOfferingGroup_model.java b/src/main/java/db/migration/V9__Create_CourseOfferingGroup_model.java
index 9c48c44af..329e87e4a 100644
--- a/src/main/java/db/migration/V9__Create_CourseOfferingGroup_model.java
+++ b/src/main/java/db/migration/V9__Create_CourseOfferingGroup_model.java
@@ -7,12 +7,14 @@
import java.util.ArrayList;
import java.util.List;
-import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.flywaydb.core.api.migration.BaseJavaMigration;
+import org.flywaydb.core.api.migration.Context;
-public class V9__Create_CourseOfferingGroup_model implements JdbcMigration {
+public class V9__Create_CourseOfferingGroup_model extends BaseJavaMigration {
@Override
- public void migrate(Connection connection) throws Exception {
+ public void migrate(Context context) throws Exception {
+ Connection connection = context.getConnection();
// Create the CourseOfferingGroups table
String createCOG = "CREATE TABLE IF NOT EXISTS `CourseOfferingGroups` ("
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 7c5ede505..94d3dab2f 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -9,8 +9,7 @@ spring.datasource.hikari.connection-test-query=SELECT 1
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.max-lifetime=1800000
-spring.datasource.jmx-enabled=false
-
+spring.jmx.enabled=false
spring.flyway.table=schema_version
# e.g. "development"