Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Pest Plugin Database Migrations

Pest Plugin Database Migrations Laravel Package

jeffersongoncalves/pest-plugin-database-migrations

A Pest PHP plugin that simplifies database migration testing by refreshing and rolling back migrations before your test suite runs, helping you write reliable, isolated database tests with minimal setup.

Deep Wiki
Context7

A Pest plugin that brings first-class database migration support to your test suite. It adds expressive helpers for running, rolling back, and refreshing migrations inside Pest tests, so each test starts from a known schema without boilerplate setUp/tearDown code.

  • Migration helpers — run, roll back, and refresh migrations with simple Pest functions.
  • Fresh schema per test — reset the database for reliable, isolated tests.
  • Laravel-friendly — integrates with Laravel's migrator and database connections.
  • Lightweight setup — register the plugin and start using it immediately.
Frequently asked questions about Pest Plugin Database Migrations
What does jeffersongoncalves/pest-plugin-database-migrations do?
It is a Pest PHP plugin that adds database migration helpers to Laravel test suites. Its main purpose is to load a package's migrations in tests in the exact order declared by its spatie/laravel-package-tools ServiceProvider. It also provides traits and expectations for running, refreshing, and rolling back migrations so tests stay isolated and schemas stay in sync.
How do I install the Pest database migrations plugin?
Install it as a Composer dependency in your Laravel project, typically as a dev dependency since it is test tooling. Use Composer to require jeffersongoncalves/pest-plugin-database-migrations, then make sure Pest is configured for your test suite. Check the package README for any required plugin registration or trait usage.
How does it load a package's migrations in the correct order?
It reads the migration order declared by the package's spatie/laravel-package-tools ServiceProvider. That means tests run the package migrations in the same sequence the package intends, rather than relying on filesystem order. This helps avoid foreign key and dependency issues when testing package schemas.
Does it work with spatie/laravel-package-tools ServiceProviders?
Yes. The package is specifically designed to respect the migration order declared by a spatie/laravel-package-tools ServiceProvider. You can use it when testing Laravel packages that register migrations through that tooling. It keeps the test migration order aligned with the package's declared order.
Can I run, refresh, and roll back migrations between tests?
Yes. The plugin adds migration helpers to your Pest test suite for running, refreshing, and rolling back migrations between tests. These helpers reduce boilerplate and help keep each test isolated with a predictable schema. You use them through the provided traits and expectations.
Does this package replace Laravel's RefreshDatabase trait?
The package provides its own migration helpers and traits for Pest tests; the provided context does not state that it replaces Laravel's RefreshDatabase trait. You can treat it as a focused helper for package migration ordering and migration lifecycle actions. Evaluate it alongside your existing database testing strategy and check the README for recommended usage.
Can I test package migrations without publishing them to the host app?
The package is built to load a package's migrations directly in tests, so you do not need to publish them into the host application just to exercise them. This is useful for package authors who want to verify migrations in isolation. It loads them in the order declared by the package's ServiceProvider.
Which Laravel and Pest versions are supported?
The package is a Pest plugin aimed at Laravel test suites, so you need a Pest-based Laravel testing setup. The exact Laravel and Pest version constraints are defined in the package's composer.json. Check those constraints before installing to confirm compatibility with your application.
Is this package safe to use in production?
No, it is test tooling intended for development and CI test suites, not production runtime. You should require it as a dev dependency and keep it out of production deployments. It helps with migration helpers and schema isolation during tests.
What are alternatives to this plugin for Laravel package migration tests?
Alternatives include Laravel's built-in database testing traits, manually calling Artisan migrate in tests, and package testing tools such as Orchestra Testbench. This plugin is specifically useful when you need Pest helpers and migration ordering from spatie/laravel-package-tools. Choose based on whether you need that exact ordering behavior and Pest integration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager