Run framework migrations even when already up to date

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 07:46:10 +00:00
parent 6958d4aff0
commit 53d359bc91

View File

@@ -164,11 +164,12 @@ fi
CURRENT_HEAD=$(git rev-parse HEAD 2>&1)
UPSTREAM_HEAD=$(git rev-parse "$UPSTREAM_BRANCH" 2>&1)
ALREADY_UP_TO_DATE=false
if [ "$CURRENT_HEAD" = "$UPSTREAM_HEAD" ]; then
echo ""
echo "✓ Already up to date"
echo ""
exit 0
ALREADY_UP_TO_DATE=true
fi
# Handle --diff option: show diff and exit
@@ -365,110 +366,117 @@ if [ "$IS_PROJECT_MODE" = false ]; then
fi
fi
# Extract and display changelog
echo ""
echo "⚠ RSpade framework has upstream changes"
echo ""
# Get commit subjects, filter out Claude Code attribution and blank lines
CHANGELOG=$(git log --pretty=format:"%s" HEAD.."$UPSTREAM_BRANCH" 2>&1 | \
grep -v "Claude Code" | \
grep -v "Co-Authored-By:" | \
grep -v "^$" | \
sed 's/^/ • /')
if [ -n "$CHANGELOG" ]; then
echo "Changelog:"
# Apply framework updates (skip if already up to date)
if [ "$ALREADY_UP_TO_DATE" = false ]; then
# Extract and display changelog
echo ""
echo "$CHANGELOG"
echo "⚠ RSpade framework has upstream changes"
echo ""
fi
# Show file diff stats (exclude ./rsx if in project mode)
if [ "$IS_PROJECT_MODE" = true ]; then
DIFF_STATS=$(git diff --stat HEAD.."$UPSTREAM_BRANCH" -- . ":(exclude)rsx" 2>&1)
else
DIFF_STATS=$(git diff --stat HEAD.."$UPSTREAM_BRANCH" 2>&1)
fi
# Get commit subjects, filter out Claude Code attribution and blank lines
CHANGELOG=$(git log --pretty=format:"%s" HEAD.."$UPSTREAM_BRANCH" 2>&1 | \
grep -v "Claude Code" | \
grep -v "Co-Authored-By:" | \
grep -v "^$" | \
sed 's/^/ • /')
if [ -n "$DIFF_STATS" ]; then
echo "Files that will be updated:"
echo ""
echo "$DIFF_STATS" | sed 's/^/ /'
echo ""
fi
# Apply updates based on mode
echo "Applying framework updates..."
if [ "$IS_PROJECT_MODE" = true ]; then
# Project mode: merge with --no-ff (preserves ./rsx via .gitattributes)
if ! git merge --no-ff "$UPSTREAM_BRANCH" 2>&1; then
echo "ERROR: Framework update failed."
if [ -n "$CHANGELOG" ]; then
echo "Changelog:"
echo ""
echo "$CHANGELOG"
echo ""
# Show current git state
GIT_STATUS=$(git status --short 2>&1)
if [ -n "$GIT_STATUS" ]; then
echo "Current git state:"
echo ""
echo "$GIT_STATUS" | sed 's/^/ /'
echo ""
fi
echo "Check status: php artisan rsx:framework:status"
exit 1
fi
echo " ✓ Framework updated (./rsx preserved by .gitattributes)"
else
# Framework mode: fast-forward only (updates everything including ./rsx)
MERGE_OUTPUT=$(git merge --ff-only "$UPSTREAM_BRANCH" 2>&1) || {
if echo "$MERGE_OUTPUT" | grep -q "up to date\|up-to-date"; then
echo " ✓ Already up to date"
else
# Show file diff stats (exclude ./rsx if in project mode)
if [ "$IS_PROJECT_MODE" = true ]; then
DIFF_STATS=$(git diff --stat HEAD.."$UPSTREAM_BRANCH" -- . ":(exclude)rsx" 2>&1)
else
DIFF_STATS=$(git diff --stat HEAD.."$UPSTREAM_BRANCH" 2>&1)
fi
if [ -n "$DIFF_STATS" ]; then
echo "Files that will be updated:"
echo ""
echo "$DIFF_STATS" | sed 's/^/ /'
echo ""
fi
# Apply updates based on mode
echo "Applying framework updates..."
if [ "$IS_PROJECT_MODE" = true ]; then
# Project mode: merge with --no-ff (preserves ./rsx via .gitattributes)
if ! git merge --no-ff "$UPSTREAM_BRANCH" 2>&1; then
echo "ERROR: Framework update failed."
echo ""
echo "ERROR: Cannot fast-forward: you have local modifications"
echo ""
# Show modified files
# Show current git state
GIT_STATUS=$(git status --short 2>&1)
if [ -n "$GIT_STATUS" ]; then
echo "Modified files blocking update:"
echo "Current git state:"
echo ""
echo "$GIT_STATUS" | sed 's/^/ /'
echo ""
fi
echo "To resolve:"
echo ""
echo " 1. VIEW DIFFERENCES"
echo " php artisan rsx:framework:pull --diff"
echo ""
echo " 2. STASH CHANGES AND UPDATE (recommended)"
echo " php artisan rsx:framework:pull --stash"
echo ""
echo " 3. DISCARD MODIFICATIONS"
echo " git reset --hard $UPSTREAM_BRANCH"
echo ""
echo " 4. COMMIT THEN UPDATE"
echo " git add -A"
echo " git commit -m \"Framework modifications\""
echo " php artisan rsx:framework:pull"
echo ""
echo " 5. CHECK STATUS"
echo " php artisan rsx:framework:status"
echo "Check status: php artisan rsx:framework:status"
exit 1
fi
}
echo " ✓ Framework updated"
echo " ✓ Framework updated (./rsx preserved by .gitattributes)"
else
# Framework mode: fast-forward only (updates everything including ./rsx)
MERGE_OUTPUT=$(git merge --ff-only "$UPSTREAM_BRANCH" 2>&1) || {
if echo "$MERGE_OUTPUT" | grep -q "up to date\|up-to-date"; then
echo " ✓ Already up to date"
else
echo "ERROR: Framework update failed."
echo ""
echo "ERROR: Cannot fast-forward: you have local modifications"
echo ""
# Show modified files
GIT_STATUS=$(git status --short 2>&1)
if [ -n "$GIT_STATUS" ]; then
echo "Modified files blocking update:"
echo ""
echo "$GIT_STATUS" | sed 's/^/ /'
echo ""
fi
echo "To resolve:"
echo ""
echo " 1. VIEW DIFFERENCES"
echo " php artisan rsx:framework:pull --diff"
echo ""
echo " 2. STASH CHANGES AND UPDATE (recommended)"
echo " php artisan rsx:framework:pull --stash"
echo ""
echo " 3. DISCARD MODIFICATIONS"
echo " git reset --hard $UPSTREAM_BRANCH"
echo ""
echo " 4. COMMIT THEN UPDATE"
echo " git add -A"
echo " git commit -m \"Framework modifications\""
echo " php artisan rsx:framework:pull"
echo ""
echo " 5. CHECK STATUS"
echo " php artisan rsx:framework:status"
exit 1
fi
}
echo " ✓ Framework updated"
fi
fi
echo ""
echo "✓ Framework updated successfully"
if [ "$ALREADY_UP_TO_DATE" = true ]; then
echo "→ Running framework maintenance (migrations and cache rebuild)..."
else
echo "✓ Framework updated successfully"
fi
echo ""
if [ "$IS_PROJECT_MODE" = true ]; then
if [ "$IS_PROJECT_MODE" = true ] && [ "$ALREADY_UP_TO_DATE" = false ]; then
echo "Your application code in ./rsx was preserved."
echo ""
fi