fix: data migration indexes#289
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request removes a previous database migration that converted Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…rovements (#290) ## Summary - **OAuth error handling**: Gracefully handle token exchange failures and missing credentials instead of crashing with unhandled exceptions - **ConnectionHub UX**: Compact layout for profile sidebar, light/dark theme support, refined disconnect button styling - **Portal improvements**: Add "Área do Usuário" navbar link, Twitch as login provider, fix hero avatar metadata key (`name` vs `username` for legacy/new GitHub records) - **Provider reconnection**: Clear `disconnected_at` when reconnecting an existing provider ## Changes ### Identity module - `OAuthController`: catch `OAuthFlowException` on token exchange, redirect with error notification - `AttachProviderToUser`: clear `disconnected_at` on reconnect - OAuth clients (Discord, GitHub, Twitch): throw `OAuthFlowException` on missing credentials ### Panel App - `ConnectionHub`: compact card layout, dark/light theme support, pill-style disconnect button, timestamp next to title - `LoginPage`: add Twitch OAuth button - Profile wrapper: light mode compatible (`bg-white dark:bg-gray-900`) ### Portal - Navbar: outlined "Área do Usuário" button linking to `/app` - `HeroSection`: support both `username` (new) and `name` (legacy) metadata keys for GitHub avatars ## Test plan - [ ] OAuth login with Discord, GitHub, and Twitch - [ ] Disconnect/reconnect a provider from profile ConnectionHub - [ ] Verify ConnectionHub renders correctly in both light and dark mode - [ ] Portal landing page loads without errors (hero avatars) - [ ] "Área do Usuário" navbar link navigates to `/app` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Description This PR enhances OAuth security and user experience across the platform. It adds comprehensive error handling for OAuth token exchanges, validates provider credentials at initialization, and resets disconnected provider states on reconnection. The ConnectionHub UI is updated with improved light/dark theme support and refined styling, while the portal gains Twitch OAuth support and fixes GitHub avatar metadata handling. The identity module prevents unhandled exceptions by catching OAuth failures with explicit error notifications. ## References - PR `#288`: [OAuth flow refactor with account merge strategy](#288) — Related OAuth improvements - PR `#272`: [Twitch integration with admin panel, tenant-scoped EventSub, and subscription management](#272) — Twitch integration foundation - PR `#289`: [Data migration indexes](#289) — Related database changes ## Dependencies & Requirements No new dependencies were added or updated in this PR. All changes utilize existing framework and module capabilities. ## Contributor Summary | Contributor | Lines Added | Lines Removed | Files Changed | |---|---|---|---| | danielhe4rt | 136 | 45 | 12 | ## Changes Summary | File Path | Change Description | |---|---| | app-modules/identity/src/Auth/Exceptions/OAuthFlowException.php | Added `tokenExchangeFailed()` factory method for formatted OAuth token exchange error messages | | app-modules/identity/src/Auth/Http/Controllers/OAuthController.php | Enhanced error handling for missing OAuth configurations, denied callbacks, and token exchange failures with try/catch blocks and redirects | | app-modules/identity/src/Auth/Actions/AttachProviderToUser.php | Reset `disconnected_at` to null on reconnection to mark providers as active again | | app-modules/integration-discord/src/OAuth/DiscordOAuthClient.php | Added validation for `access_token` presence in Discord token response; throws `OAuthFlowException` on missing token | | app-modules/integration-github/src/IntegrationGithubServiceProvider.php | Added validation for GitHub client credentials with explicit RuntimeException on missing configuration | | app-modules/integration-github/src/OAuth/GitHubOAuthClient.php | Added validation for `access_token` in GitHub token response; throws `OAuthFlowException` on missing token | | app-modules/integration-twitch/src/OAuth/TwitchOAuthClient.php | Added validation for `access_token` in Twitch token response; throws `OAuthFlowException` on missing token | | app-modules/panel-app/resources/views/auth/login.blade.php | Added Twitch OAuth login button alongside Discord and GitHub options | | app-modules/panel-app/resources/views/pages/profile.blade.php | Updated profile card styling with rounded backgrounds, rings, and dark mode variants | | app-modules/portal/resources/views/components/navbar.blade.php | Added responsive "Área do Usuário" link and restructured Discord button for mobile/desktop variants | | app-modules/portal/src/Livewire/HeroSection.php | Updated avatar metadata mapping to support both legacy `name` and new `username` keys for GitHub records | | resources/views/livewire/connection-hub.blade.php | Refined ConnectionHub styling for light/dark theme compatibility, updated disconnect button and permissions section appearance | <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/he4rt/heartdevs.com/pull/290?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
This PR fixes data migration issues by replacing a problematic tenant ID type conversion migration with a new index restoration migration. Instead of converting
tenant_idfrom bigint to UUID (which proved problematic), the PR takes a more targeted approach by recreating essential tenant-related indexes across 34 tables using concurrent index creation with optimized memory settings.References
#288: OAuth flow refactor with account merge strategy#282: Profile module phase 1 with legacy cleanup#274: Profile module with tenant-scoped user profilesChanges Summary
Contributor Summary