Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gak committed Jul 29, 2024
1 parent c16479b commit 65959dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/ensure-frozen-migrations
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ show_diff() {
diff -u <(remove_comments "$file1") <(remove_comments "$file2")
}

fail() {
echo "❌ Existing migrations changed. Please make sure only comments are changed in existing migration files."
exit 1
}

main() {
local sql_dir="backend/controller/sql/schema"
local changed_files
Expand Down Expand Up @@ -52,16 +57,15 @@ main() {
else
echo "❌ Migration files changes detected"
show_diff "$file" <(git show "$merge_base:$file")
exit 1
fail
fi
done <<< "$changed_files"

# We should also check if there were any deleted files
while IFS= read -r file; do
if ! git show "$merge_base:$file" &> /dev/null; then
echo "🔥 Deleted: $file"
echo "❌ Migration files changes detected"
exit 1
fail
fi
done < <(git diff --name-only "$merge_base" -- "$sql_dir"/*.sql)

Expand Down

0 comments on commit 65959dd

Please sign in to comment.