Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1262 +/- ##
==========================================
+ Coverage 68.04% 68.07% +0.02%
==========================================
Files 261 261
Lines 15271 15354 +83
==========================================
+ Hits 10391 10452 +61
- Misses 4432 4447 +15
- Partials 448 455 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces first-class support for database seeders in the Goravel framework by adding a new WithSeeders method to the ApplicationBuilder. The implementation mirrors the existing migration support pattern and includes automated registration in bootstrap setup, allowing seeders to be registered declaratively alongside other application components.
Key changes:
- Added
WithSeedersmethod to ApplicationBuilder interface and implementation for registering database seeders - Implemented
AddSeederfunction in the modify package to automatically add seeders to bootstrap configuration - Updated
SeederMakeCommandto use the new bootstrap setup when available, with fallback to legacy kernel registration
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
contracts/foundation/application_builder.go |
Added WithSeeders method to ApplicationBuilder interface |
foundation/application_builder.go |
Implemented WithSeeders method and seeder registration logic in Create() |
mocks/foundation/ApplicationBuilder.go |
Generated mock implementation for WithSeeders method |
packages/modify/actions.go |
Added AddSeeder function and supporting helpers to modify bootstrap files |
packages/modify/actions_test.go |
Comprehensive test coverage for AddSeeder and related functions |
database/console/seeder_make_command.go |
Updated to use bootstrap setup via AddSeeder when available |
database/console/seeder_make_command_test.go |
Added tests for bootstrap setup integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/modify/actions.go
Outdated
| // Into: | ||
| // | ||
| // foundation.Setup().WithSeeders([]seeder.Seeder{ | ||
| // &seeders.ExampleMigration{}, |
There was a problem hiding this comment.
The documentation example references "ExampleMigration" instead of "ExampleSeeder". This should be corrected for consistency.
Example:
// foundation.Setup().WithSeeders([]seeder.Seeder{
// &seeders.ExampleSeeder{},
// }).WithConfig(config.Boot).Run()|
My only concern is that bootstrap/app.go will grow too large, so we might need to create separate files for functions like WithMigrations, WithSeeders, and others. |
Yes, will optimize it next. |
📑 Description
Closes goravel/goravel#797
This pull request introduces first-class support for database seeders in the Goravel framework by adding a new
WithSeedersmethod to the application builder and automating the registration of seeders in bootstrap setup. The changes streamline seeder creation and registration, improve test coverage, and enhance the codebase to support future removal of legacy kernel-based registration.✅ Checks