diff --git a/.github/workflows/generate-application-server-client.yml b/.github/workflows/generate-application-server-client.yml
index 6c671cec..1c0ad012 100644
--- a/.github/workflows/generate-application-server-client.yml
+++ b/.github/workflows/generate-application-server-client.yml
@@ -37,6 +37,12 @@ jobs:
distribution: 'temurin'
java-version: '21'
+ - name: Set up directories
+ working-directory: server/application-server
+ run: |
+ mkdir -p ./keycloak-data
+ chmod -R 755 ./keycloak-data
+
- name: Install dependencies
run: npm install
diff --git a/package.json b/package.json
index 55a64d59..59110344 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,8 @@
"generate:api:intelligence-service": "npm run generate:api:intelligence-service:clean && npm run generate:api:intelligence-service-specs && npm run generate:api:intelligence-service-client",
"generate:api": "npm run generate:api:intelligence-service && npm run generate:api:application-server",
"prettier:java:check": "prettier --check server/application-server/src/**/*.java",
- "prettier:java:write": "prettier --write server/application-server/src/**/*.java"
+ "prettier:java:write": "prettier --write server/application-server/src/**/*.java",
+ "db:changelog:diff": "cd server/application-server && docker compose up -d postgres && mvn liquibase:diff && docker compose down postgres"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "2.13.5",
diff --git a/server/application-server/compose.yaml b/server/application-server/compose.yaml
index ad5b8703..ce2da33c 100644
--- a/server/application-server/compose.yaml
+++ b/server/application-server/compose.yaml
@@ -26,10 +26,14 @@ services:
ports:
- '8081:8080'
volumes:
+ - keycloak-data:/opt/keycloak/data/
- ./keycloak-hephaestus-realm-example-config.json:/opt/keycloak/data/import/hephaestus-realm.json
networks:
- app-network
networks:
app-network:
- driver: bridge
\ No newline at end of file
+ driver: bridge
+
+volumes:
+ keycloak-data:
\ No newline at end of file
diff --git a/server/application-server/pom.xml b/server/application-server/pom.xml
index 53ba506c..d704ef0c 100644
--- a/server/application-server/pom.xml
+++ b/server/application-server/pom.xml
@@ -72,6 +72,11 @@
org.liquibase
liquibase-core
+
+ org.liquibase.ext
+ liquibase-hibernate6
+ 4.27.0
+
org.springframework.boot
spring-boot-starter-logging
@@ -265,6 +270,49 @@
.
+
+ org.liquibase
+ liquibase-maven-plugin
+ 4.27.0
+
+ db/master.xml
+ src/main/resources/db/changelog_new.xml
+ org.postgresql.Driver
+ jdbc:postgresql://localhost:5432/hephaestus
+ root
+ root
+
+ hibernate:spring:de.tum.in.www1.hephaestus?dialect=org.hibernate.dialect.PostgreSQLDialect
+ &hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
+ &hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
+
+
+ true
+
+
+
+
+ org.liquibase.ext
+ liquibase-hibernate6
+ 4.27.0
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+ 3.3.3
+
+
+ jakarta.validation
+ jakarta.validation-api
+ 3.0.2
+
+
+ org.postgresql
+ postgresql
+ 42.7.3
+
+
+
\ No newline at end of file
diff --git a/server/application-server/src/main/resources/application-prod.yml b/server/application-server/src/main/resources/application-prod.yml
index 22613429..c3e91b94 100644
--- a/server/application-server/src/main/resources/application-prod.yml
+++ b/server/application-server/src/main/resources/application-prod.yml
@@ -5,8 +5,7 @@ spring:
password: ${DATABASE_PASSWORD}
jpa:
hibernate:
- # TODO: Change to none and use liquibase
- ddl-auto: update
+ ddl-auto: none
security:
oauth2:
diff --git a/server/application-server/src/main/resources/db/initial-schema.xml b/server/application-server/src/main/resources/db/initial-schema.xml
new file mode 100644
index 00000000..879fbace
--- /dev/null
+++ b/server/application-server/src/main/resources/db/initial-schema.xml
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/server/application-server/src/main/resources/db/master.xml b/server/application-server/src/main/resources/db/master.xml
index 55cc07d8..a0620641 100644
--- a/server/application-server/src/main/resources/db/master.xml
+++ b/server/application-server/src/main/resources/db/master.xml
@@ -5,15 +5,6 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
-
-
-
-
-
-
-
-
-
-
+