-
Notifications
You must be signed in to change notification settings - Fork 17
40 lines (37 loc) · 2.07 KB
/
prevent-temp-migrations.yml
File metadata and controls
40 lines (37 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Prevent Temporary Migrations on Main
on:
pull_request:
branches: [main]
jobs:
block-temp-migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for temporary migrations
run: |
# Check for any temp migrations (both TEMP and temp)
shopt -s nullglob
temp_migrations=(pkgs/core/supabase/migrations/*_pgflow_TEMP_*.sql pkgs/core/supabase/migrations/*_pgflow_temp_*.sql)
if [ ${#temp_migrations[@]} -gt 0 ]; then
echo "::error::❌ Temporary migrations found! These cannot be merged to main."
echo -e "\033[31m"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "❌ TEMPORARY MIGRATIONS DETECTED - CANNOT MERGE TO MAIN"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Found temporary migrations:"
printf ' • %s\n' "${temp_migrations[@]}"
echo ""
echo "TO FIX: Remove temp migrations and generate final migration:"
echo ""
echo " git rm -f pkgs/core/supabase/migrations/*_pgflow_TEMP_*.sql"
echo " git rm -f pkgs/core/supabase/migrations/*_pgflow_temp_*.sql"
echo " cd pkgs/core"
echo " ./scripts/atlas-migrate-hash --yes"
echo " ./scripts/atlas-migrate-diff your_feature_name"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "\033[0m"
exit 1
fi
echo "✅ No temporary migrations found"