From 25c9e4c3bf576b785fb50fc025df0c5f58b7947e Mon Sep 17 00:00:00 2001 From: 1AhmedYasser <26207361+1AhmedYasser@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:56:56 +0300 Subject: [PATCH] chore(0): Refactored liquibase path --- DSL/Liquibase/liquibase.properties | 2 +- DSL/Liquibase/{changelog.yaml => master.yml} | 2 +- create-migration.sh | 9 +++++++-- migrate.sh | 8 +------- 4 files changed, 10 insertions(+), 11 deletions(-) rename DSL/Liquibase/{changelog.yaml => master.yml} (63%) diff --git a/DSL/Liquibase/liquibase.properties b/DSL/Liquibase/liquibase.properties index 209dda50d..f1c148246 100644 --- a/DSL/Liquibase/liquibase.properties +++ b/DSL/Liquibase/liquibase.properties @@ -1,4 +1,4 @@ -changelogFile: /changelog/changelog.yaml +changelogFile: /changelog/master.yaml url: jdbc:postgresql://database:5432/services_db username: byk password: 01234 diff --git a/DSL/Liquibase/changelog.yaml b/DSL/Liquibase/master.yml similarity index 63% rename from DSL/Liquibase/changelog.yaml rename to DSL/Liquibase/master.yml index c932f8b07..8e0d64de3 100644 --- a/DSL/Liquibase/changelog.yaml +++ b/DSL/Liquibase/master.yml @@ -1,4 +1,4 @@ databaseChangeLog: - includeAll: path: changelog/ - maxDepth: 1 + errorIfMissingOrEmpty: true diff --git a/create-migration.sh b/create-migration.sh index f91fe7203..a6423322f 100755 --- a/create-migration.sh +++ b/create-migration.sh @@ -5,5 +5,10 @@ if [[ $# -eq 0 ]] ; then exit 0 fi -echo "-- liquibase formatted sql" > "DSL/Liquibase/changelog/`date '+%s'`-$1.sql" -echo "-- changeset $(git config user.name):`date '+%s'`" >> "DSL/Liquibase/changelog/`date '+%s'`-$1.sql" +timestamp=$(date '+%Y%m%d%H%M%S') +migration_file="DSL/Liquibase/changelog/${timestamp}-$1.sql" + +echo "-- liquibase formatted sql" > "$migration_file" +echo "-- changeset $(git config user.name):$timestamp" >> "$migration_file" + +echo "Migration file created: $migration_file" diff --git a/migrate.sh b/migrate.sh index 719eb42a0..e85a19500 100755 --- a/migrate.sh +++ b/migrate.sh @@ -1,8 +1,2 @@ #!/bin/bash -docker run --rm --network bykstack \ - -v $(pwd)/DSL/Liquibase:/workspace \ - -w /workspace \ - liquibase/liquibase \ - --defaultsFile=liquibase.properties \ - --changelog-file=changelog.yaml \ - update +docker run --rm --network bykstack -v `pwd`/DSL/Liquibase/changelog:/liquibase/changelog -v `pwd`/DSL/Liquibase/master.yml:/liquibase/master.yml -v `pwd`/DSL/Liquibase/data:/liquibase/data liquibase/liquibase:4.28 --defaultsFile=/liquibase/changelog/liquibase.properties --changelog-file=master.yml --url=jdbc:postgresql://database:5432/services_db?user=byk --password=01234 update