fix(ci): skip applied migrations in preflight validation
TaxBaik CI/CD / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-07-02 14:23:01 +09:00
parent 3f486d9fe9
commit 96c7ab5e54
+14
View File
@@ -47,10 +47,24 @@ if ! command -v psql >/dev/null 2>&1; then
exit 1
fi
mapfile -t executed_versions < <(
psql "$DB_CONNECTION_STRING" -Atc "SELECT version FROM schema_migrations ORDER BY version;" 2>/dev/null || true
)
declare -A executed_map=()
for version in "${executed_versions[@]}"; do
if [ -n "$version" ]; then
executed_map["$version"]=1
fi
done
for file in "${files[@]}"; do
name="$(basename "$file")"
version="${name#V}"
version="${version%%__*}"
if [ -n "${executed_map[$version]:-}" ]; then
continue
fi
echo "Dry-run migration V$version: $name"
psql "$DB_CONNECTION_STRING" -v ON_ERROR_STOP=1 <<PSQL
BEGIN;