@@ -213,9 +213,8 @@ setup_project() {
213213 export PGPASSWORD=" $SUPABASE_DB_PASSWORD "
214214
215215 # Run the link command directly - no retries to avoid confusion
216- # Add GODEBUG=netdns=4 to force IPv4 DNS resolution
217- echo -e " ${YELLOW} Running: GODEBUG=netdns=4 supabase link --project-ref \" $PROJECT_REF \" --password \" $SUPABASE_DB_PASSWORD \" --debug${NC} "
218- GODEBUG=netdns=4 supabase link --project-ref " $PROJECT_REF " --password " $SUPABASE_DB_PASSWORD " --debug
216+ echo -e " ${YELLOW} Running: supabase link --project-ref \" $PROJECT_REF \" --password \" $SUPABASE_DB_PASSWORD \" --debug${NC} "
217+ supabase link --project-ref " $PROJECT_REF " --password " $SUPABASE_DB_PASSWORD " --debug
219218
220219 if [ $? -eq 0 ]; then
221220 echo -e " ${GREEN} Link successful!${NC} "
@@ -276,31 +275,12 @@ run_migrations() {
276275 echo -e " ${YELLOW} Using hardcoded project reference as fallback: $PROJECT_REF ${NC} "
277276 fi
278277
279- # Set up the database URL for direct cloud connection
280- # Force IPv4 by resolving the hostname to an IPv4 address
281- echo -e " ${YELLOW} Resolving db.${PROJECT_REF} .supabase.co to IPv4 address...${NC} "
282- DB_HOST=$( getent ahostsv4 db.${PROJECT_REF} .supabase.co | head -n 1 | awk ' {print $1}' )
278+ # Use the Supabase CLI to push migrations without direct database connection
279+ echo -e " ${YELLOW} Running migrations using Supabase CLI...${NC} "
283280
284- if [ -z " $DB_HOST " ]; then
285- echo -e " ${YELLOW} Failed to resolve IPv4 address, using hostname...${NC} "
286- DB_HOST=" db.${PROJECT_REF} .supabase.co"
287- else
288- echo -e " ${YELLOW} Using IPv4 address: $DB_HOST ${NC} "
289- fi
290-
291- DB_URL=" postgresql://postgres:${SUPABASE_DB_PASSWORD} @$DB_HOST :5432/postgres"
292- echo -e " ${YELLOW} Using cloud database URL for migrations...${NC} "
293-
294- # Run the migration command directly with the cloud database URL
295- echo -e " ${YELLOW} Running migrations on cloud database...${NC} "
296-
297- # Set up PGPASSWORD environment variable
298- export PGPASSWORD=" $SUPABASE_DB_PASSWORD "
299-
300- # Run the command with the cloud database URL - no retries to avoid confusion
301- # Add GODEBUG=netdns=4 to force IPv4 DNS resolution
302- echo -e " ${YELLOW} Running: GODEBUG=netdns=4 supabase db push --db-url <DB_URL> --debug${NC} "
303- GODEBUG=netdns=4 supabase db push --db-url " $DB_URL " --debug
281+ # Run the command without direct database URL to use the linked project
282+ echo -e " ${YELLOW} Running: supabase db push${NC} "
283+ supabase db push
304284
305285 if [ $? -eq 0 ]; then
306286 echo -e " ${GREEN} Migration successful!${NC} "
0 commit comments