SeedSpotter is a Laravel package that helps you detect discrepancies between your database seeders and the actual database content. It's an essential tool for maintaining data integrity in your Laravel applications.
- Compare seeder data with actual database content
- Detect missing, extra, or different rows
- Ignore specified columns in comparisons
- Easy-to-use Artisan command
- Configurable through Laravel's config system
You can install the package via composer:
composer require abdulmannans/seed-spotter
The package will automatically register its service provider.
The easiest way to use SeedSpotter is through its Artisan command:
php artisan seed-spotter:compare "Database\Seeders\YourSeeder" --table=your_table_name
This command will run the comparison and display the results in your console.
You can also use SeedSpotter in your PHP code:
use Abdulmannans\SeedSpotter\Facades\SeedSpotter;
$result = SeedSpotter::compare(YourSeederClass::class, "your_table_name");
if ($result["has_discrepancies"]) {
foreach ($result["discrepancies"] as $discrepancy) {
// Handle discrepancy
}
} else {
// Data is in sync
}
To customize SeedSpotter's behavior, you can publish the configuration file:
php artisan vendor:publish --provider="Abdulmannans\SeedSpotter\SeedSpotterServiceProvider" --tag="config"
This will create a config/seed-spotter.php
file. Here are the available options:
return [
// The default table to check if not specified
"table" => "users",
// Columns to ignore in comparisons
"ignore_columns" => ["created_at", "updated_at"],
];
To run the package tests, use:
composer test
Contributions are welcome! Please feel free to submit a Pull Request.
The MIT License (MIT). Please see License File for more information.
- Abdul Mannan (https://github.com/abdulmannans)
- All Contributors
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Made with β€οΈ by Abdul Mannan(https://github.com/abdulmannans)