All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
30 lines
903 B
Bash
30 lines
903 B
Bash
#!/bin/bash
|
|
# Apply database migration 005 - Add password reset fields
|
|
|
|
# Get the database pod name
|
|
DB_POD=$(kubectl get pod -n my-apps -l app.kubernetes.io/component=db -o jsonpath='{.items[0].metadata.name}')
|
|
|
|
if [ -z "$DB_POD" ]; then
|
|
echo "❌ Database pod not found"
|
|
exit 1
|
|
fi
|
|
|
|
echo "📦 Database pod: $DB_POD"
|
|
echo "📝 Applying migration 005_add_password_reset_fields.sql..."
|
|
echo ""
|
|
|
|
# Copy migration file to pod
|
|
kubectl cp backend/migrations/005_add_password_reset_fields.sql my-apps/$DB_POD:/tmp/migration.sql
|
|
|
|
# Execute migration
|
|
kubectl exec -n my-apps $DB_POD -- psql -U brand_master_user -d brand_master_db -f /tmp/migration.sql
|
|
|
|
echo ""
|
|
echo "✅ Migration applied successfully!"
|
|
echo ""
|
|
echo "🔄 Restarting backend pod to pick up changes..."
|
|
kubectl delete pod -n my-apps -l app.kubernetes.io/component=backend
|
|
|
|
echo ""
|
|
echo "✅ Done! Backend will restart with updated schema."
|