abdulmannans/seed-spotter
最新稳定版本:v2.0.1
Composer 安装命令:
composer require abdulmannans/seed-spotter
包简介
A package to spot the discrepancies between database and seeders
README 文档
README
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.
Features
- 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
Installation
You can install the package via composer:
composer require abdulmannans/seed-spotter
The package will automatically register its service provider.
Usage
Using the Artisan Command
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.
Using in Code
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 }
Configuration
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"], ];
Testing
To run the package tests, use:
composer test
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT). Please see License File for more information.
Credits
- Abdul Mannan (https://github.com/abdulmannans)
- All Contributors
Support
If you discover any security related issues, please email samannan1999@gmail.com instead of using the issue tracker.
Made with ❤️ by Abdul Mannan(https://github.com/abdulmannans)
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-12