#!/bin/bash
# Survey Module Setup — run once after starting MySQL
cd "$(dirname "$0")"

echo "▶ Running migrations..."
php artisan migrate --path=database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php --force
php artisan migrate --path=database/migrations/2026_06_18_000100_create_survey_sessions_table.php --force
php artisan migrate --path=database/migrations/2026_06_18_000101_create_survey_items_table.php --force
php artisan migrate --path=database/migrations/2026_06_18_000102_create_survey_item_photos_table.php --force

echo "▶ Creating storage symlink..."
php artisan storage:link --force 2>/dev/null || true

echo "▶ Clearing caches..."
php artisan config:clear
php artisan route:clear

echo "✅ Survey module ready!"
