sojorn/_legacy/supabase/apply-migration.ps1
Patrick Britton 3c4680bdd7 Initial commit: Complete threaded conversation system with inline replies
**Major Features Added:**
- **Inline Reply System**: Replace compose screen with inline reply boxes
- **Thread Navigation**: Parent/child navigation with jump functionality
- **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy
- **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions

 **Frontend Changes:**
- **ThreadedCommentWidget**: Complete rewrite with animations and navigation
- **ThreadNode Model**: Added parent references and descendant counting
- **ThreadedConversationScreen**: Integrated navigation handlers
- **PostDetailScreen**: Replaced with threaded conversation view
- **ComposeScreen**: Added reply indicators and context
- **PostActions**: Fixed visibility checks for chain buttons

 **Backend Changes:**
- **API Route**: Added /posts/:id/thread endpoint
- **Post Repository**: Include allow_chain and visibility fields in feed
- **Thread Handler**: Support for fetching post chains

 **UI/UX Improvements:**
- **Reply Context**: Clear indication when replying to specific posts
- **Character Counting**: 500 character limit with live counter
- **Visual Hierarchy**: Depth-based indentation and styling
- **Smooth Animations**: SizeTransition, FadeTransition, hover states
- **Chain Navigation**: Parent/child buttons with visual feedback

 **Technical Enhancements:**
- **Animation Controllers**: Proper lifecycle management
- **State Management**: Clean separation of concerns
- **Navigation Callbacks**: Reusable navigation system
- **Error Handling**: Graceful fallbacks and user feedback

This creates a Reddit-style threaded conversation experience with smooth
animations, inline replies, and intuitive navigation between posts in a chain.
2026-01-30 07:40:19 -06:00

77 lines
3.3 KiB
PowerShell

# PowerShell script to apply database migration via Supabase CLI
# This connects to your remote Supabase project and applies the search function update
$PROJECT_REF = "zwkihedetedlatyvplyz"
$MIGRATION_FILE = "migrations/update_search_function.sql"
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host "Sojorn Database Migration" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "This will update the search_sojorn() function to enable:" -ForegroundColor Yellow
Write-Host " - Full-text search in post bodies" -ForegroundColor White
Write-Host " - User search by display name AND handle" -ForegroundColor White
Write-Host " - Hashtag search with post results" -ForegroundColor White
Write-Host ""
# Check if Supabase CLI is installed
if (-not (Get-Command supabase -ErrorAction SilentlyContinue)) {
Write-Host "ERROR: Supabase CLI is not installed or not in PATH" -ForegroundColor Red
Write-Host "Install via: scoop install supabase" -ForegroundColor Yellow
Write-Host "Or visit: https://supabase.com/docs/guides/cli" -ForegroundColor Yellow
exit 1
}
Write-Host "Step 1: Linking to Supabase project..." -ForegroundColor Green
Write-Host "Project Reference: $PROJECT_REF" -ForegroundColor White
# Link to project (will prompt for database password if needed)
$linkResult = supabase link --project-ref $PROJECT_REF 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "ERROR: Failed to link to Supabase project" -ForegroundColor Red
Write-Host "Please ensure you have the correct project reference and database password" -ForegroundColor Yellow
Write-Host ""
Write-Host "Alternative: Apply via Supabase Dashboard" -ForegroundColor Cyan
Write-Host "1. Go to: https://app.supabase.com/project/$PROJECT_REF/sql" -ForegroundColor White
Write-Host "2. Copy contents of: $MIGRATION_FILE" -ForegroundColor White
Write-Host "3. Paste and run in SQL Editor" -ForegroundColor White
exit 1
}
Write-Host ""
Write-Host "Step 2: Applying migration..." -ForegroundColor Green
Write-Host "Reading: $MIGRATION_FILE" -ForegroundColor White
# Read the migration SQL
if (-not (Test-Path $MIGRATION_FILE)) {
Write-Host "ERROR: Migration file not found: $MIGRATION_FILE" -ForegroundColor Red
exit 1
}
$sql = Get-Content $MIGRATION_FILE -Raw
# Apply the migration
Write-Host "Executing SQL..." -ForegroundColor White
$result = $sql | supabase db execute 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host ""
Write-Host "SUCCESS! Migration applied successfully" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Test the search functionality in your app" -ForegroundColor White
Write-Host "2. Search for users, hashtags, and words in posts" -ForegroundColor White
Write-Host "3. Click hashtags in posts to navigate to search" -ForegroundColor White
} else {
Write-Host ""
Write-Host "ERROR: Migration failed" -ForegroundColor Red
Write-Host "Error output:" -ForegroundColor Yellow
Write-Host $result
Write-Host ""
Write-Host "Try applying manually via Supabase Dashboard:" -ForegroundColor Cyan
Write-Host "https://app.supabase.com/project/$PROJECT_REF/sql" -ForegroundColor White
exit 1
}