Skip to content

Commit

Permalink
Default DB schema fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ximtech committed Sep 20, 2024
1 parent 52b5312 commit 883cbbb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
java-version: '21'
cache: 'gradle'

- name: Run Integration Tests
Expand Down
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ plugins {
id 'idea'
id 'java'
id 'groovy'
id 'org.springframework.boot' version '3.0.0'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.springframework.boot' version '3.2.6'
id 'io.spring.dependency-management' version '1.1.4'
}

group = 'com.altium.migrator'
version = '1.0.0'
version = '1.1.0'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

configurations {
Expand Down Expand Up @@ -42,6 +42,7 @@ ext {
jgitVersion = '6.4.0.202211300538-r'
testContainersVersion = '1.17.6'
commonsIOVersion = '2.11.0'
spockVersion = '2.3-groovy-3.0'
}

sourceSets {
Expand Down Expand Up @@ -69,9 +70,9 @@ dependencies {
runtimeOnly "org.postgresql:postgresql"

// Testing, Spock, Groovy
testImplementation "org.codehaus.groovy:groovy-all:3.0.8"
testImplementation "org.spockframework:spock-core:2.3-groovy-3.0"
testImplementation "org.spockframework:spock-spring:2.3-groovy-3.0"
testImplementation "org.codehaus.groovy:groovy-all:3.0.20"
testImplementation "org.spockframework:spock-core:$spockVersion"
testImplementation "org.spockframework:spock-spring:$spockVersion"

testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.testcontainers:spock:$testContainersVersion"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

@Slf4j
@Service
Expand All @@ -42,6 +43,8 @@ public void processDataMigration() {
DirectoryResourceAccessor resourceAccessor = new DirectoryResourceAccessor(changelogDirectory);
PostgresDatabase postgresDatabase = new PostgresDatabase();
postgresDatabase.setConnection(new JdbcConnection(connection));
Statement statement = connection.createStatement();
statement.execute("CREATE SCHEMA IF NOT EXISTS %1$s; SET SEARCH_PATH TO %1$s;".formatted(defaultSchemaName));
postgresDatabase.setDefaultSchemaName(defaultSchemaName);
liquibase = new Liquibase(dbChangelogFileName, resourceAccessor, postgresDatabase);
Contexts contexts = new Contexts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class DatabaseSpecTemplate extends Specification {

@Shared
static final PostgreSQLContainer<?> POSTGRE_SQL_CONTAINER = new PostgreSQLContainer<>(POSTGRES_TEST_IMAGE)
.withInitScript('init.sql')
.withUsername(POSTGRES_USERNAME)
.withPassword(POSTGRES_PASSWORD)

Expand Down
4 changes: 0 additions & 4 deletions src/test/resources/init.sql

This file was deleted.

0 comments on commit 883cbbb

Please sign in to comment.