fix: [#672] facades.Orm() doesn't refresh after calling facades.Testing().Docker().Database()#1033
Merged
fix: [#672] facades.Orm() doesn't refresh after calling facades.Testing().Docker().Database()#1033
Conversation
…ng().Docker().Database()
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue #672 by ensuring the ORM facade is properly refreshed after nested facade calls, and by standardizing the refresh mechanism across the container and application.
- Renamed the container’s
Refreshmethod toFresh(and updated tests/mocks accordingly). - Added an
Application.Refresh()helper that invokes the container refresh and reboots service providers. - Refactored ORM initialization to use the new no-arg refresh signature and adjusted service provider error handling.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mocks/foundation/Application.go | Updated mock Refresh to a no-arg signature. |
| foundation/container.go | Renamed Refresh to Fresh and updated implementation. |
| foundation/container_test.go | Renamed tests from Refresh to Fresh. |
| foundation/application.go | Added Application.Refresh() and repositioned setTimezone. |
| database/service_provider.go | Changed error branch to return a fallback ORM instance. |
| database/orm/orm.go | Updated Refresh signature and BuildOrm fallback logic. |
| contracts/foundation/application.go | Updated Refresh signature and simplified its doc comment. |
Comments suppressed due to low confidence (1)
foundation/application.go:95
- There are no existing tests for
Application.Refresh(). Consider adding a unit test to confirm it invokes both the container refresh and service provider bootstrapping as expected.
func (app *Application) Refresh() {
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.15.x #1033 +/- ##
==========================================
Coverage ? 68.67%
==========================================
Files ? 218
Lines ? 18803
Branches ? 0
==========================================
Hits ? 12913
Misses ? 5228
Partials ? 662 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
hwbrzzl
commented
May 15, 2025
| // facades should be refresh simulaneously. | ||
| Refresh(bindings ...any) | ||
| // Refresh all modules after changing config, will call the Boot method simultaneously. | ||
| Refresh() |
Contributor
Author
There was a problem hiding this comment.
This function is not documented, it is only used internally, User shouldn't use it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 Description
Closes goravel/goravel#672
This pull request introduces several changes across multiple files to improve code consistency, enhance functionality, and simplify maintenance. The most significant updates include centralizing binding constants, refactoring service provider methods for clarity, adding new functionalities to caching and database interfaces, and enhancing test cases for better maintainability.
Refactoring and Centralization of Binding Constants
contracts/binding.gofile to centralize all binding constants, replacing hardcoded string bindings across the codebase.auth,cache,config,console,crypt) to use the centralized binding constants for cleaner and more maintainable code. [1] [2] [3] [4] [5]Enhancements to Caching and Locking
BlockWithTickermethod to theLockinterface and its implementation, allowing for customizable retry intervals when attempting to acquire a lock. [1] [2]Driverinterface documentation to clarify the behavior of theLockmethod when expiration is not set.Database Schema and Query Improvements
Blueprintinterface.Grammarinterface to include support for boolean column definitions.QueryWithSetContextinterface withQueryWithContextfor better naming consistency and functionality.Updates to Console Application
NewApplicationfunction inconsole/application.goto accept auseArtisanflag, improving flexibility in command handling.useArtisanparameter. [1] [2]New Features and Interfaces
Storeinterface incontracts/http/store.goto support rate-limiting mechanisms.These changes collectively improve code readability, maintainability, and functionality while introducing new capabilities to the framework.
✅ Checks