Skip to content
Browse files

Fix changelog scrip for Windows; add documentation

  • Loading branch information
erikhofer committed Oct 2, 2019
1 parent 1e7223b commit 80380cacdcfeb4d5edc863858e5fcb1f6f187855
@@ -8,11 +8,8 @@ Create a file `src/main/resources/application-dev.yml`. For documentation on how
server see[`application.yml`]
in the same directory. Minimum configuration that uses the in-memory database:
database: HSQL
ddl-auto: create
spring.jpa.database: HSQL
spring.jpa.hibernate.ddl-auto: update

=== Database
@@ -21,14 +18,12 @@ the application shuts down. For Postgres create at least a dedicated database an
url: "jdbc:postgresql://[host]:[port]/database"
username: user
password: supersecure
url: "jdbc:postgresql://localhost:5432/codefreak"
username: postgres
password: portgres
driver-class-name: org.postgresql.Driver
database-platform: org.hibernate.dialect.PostgreSQLDialect
ddl-auto: update

=== Docker
@@ -81,6 +76,17 @@ $ ./gradlew vagrantTest # for testing with Vagrant Docker daemon
$ ./gradlew spotlessApply

== Making changes to the database schema
If you modify the entity layer under `de.code_freak.codefreak.entity` in a way that changes the database schema,
you have to create a migration changelog. Code FREAK uses[Liquibase] for versioning the database
schema. After you made your changes to the JPA entities, execute the script `` in the project directory.
It will create a new file under `src/main/resources/db/changelogs`. It contains differences between the latest schema version
and the JPA entities. Modify the file if needed, for example if you create a new non-null column, add a `value` that is used
for existing records. Keep in mind that the migration will be run on existing production databases. Please refer to the[Liquibase documentation] for more information on changelogs.

NOTE: If you are on Windows, the script does not work on all emulated shells. Make sure to use one that is based on `bash`.

== Releasing a new version

The project is split up into a main application and some auxiliary that have there own repositories (e.g. the IDE).
@@ -4,7 +4,7 @@ set -e
date=$(date '+%Y%m%d%H%M%S')
echo "Please enter a summary for this migration: "
read summary
filename=${date}-$(echo "$summary" | sed -e 's/[^A-Za-z0-9._]+/_/g' | tr '[:upper:]' '[:lower:]').yaml
filename=${date}-$(echo "$summary" | sed -r 's/[^A-Za-z0-9._]+/-/g' | tr '[:upper:]' '[:lower:]').yaml
./gradlew clean assemble liquibaseUpdate
./gradlew liquibaseDiffChangelog -PchangeLogFile=src/main/resources/db/changelogs/$filename
cat << EOL >> src/main/resources/db/changelog-master.yaml
@@ -1,4 +1,4 @@
- include:
file: changelogs/0001-initial.yaml
file: changelogs/20191002162627-initial.yaml
relativeToChangelogFile: true

0 comments on commit 80380ca

Please sign in to comment.
You can’t perform that action at this time.