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
Laravel Data Migrations

Laravel Data Migrations Laravel Package

jlorente/laravel-data-migrations

Laravel Data Migrations lets you run versioned data changes separately from schema migrations. Create migration classes to seed or transform data, track executed migrations, and roll back safely while keeping database structure changes clean.

View on GitHub
Deep Wiki
Context7

An extension to allow you to separate data migrations from structure migrations

Frequently asked questions about Laravel Data Migrations
What is jlorente/laravel-data-migrations used for?
It is a Laravel package that lets you run versioned data changes, such as seeding or transforming rows, separately from your schema structure migrations. You write dedicated data migration classes, the package records which ones have executed, and you can roll them back safely. The goal is keeping schema migrations clean and focused purely on structural changes.
How do I install jlorente/laravel-data-migrations?
Install it with Composer by running composer require jlorente/laravel-data-migrations. The package exposes Artisan console commands, so it slots into Laravel's existing console kernel and scheduling surfaces without a new runtime dependency. Check the README for any optional config publish step and for the exact command names.
Which Laravel and PHP versions does laravel-data-migrations support?
The package is maintained on a stable 2.x major line, with 2.0.2 being the latest patch release at the time of writing. Before bumping, read the composer.json constraints in the repository and compare them against your application's Laravel and PHP versions, because patch releases occasionally narrow requirements. Confirm the floors match your runtime before rolling out.
How do I create a new data migration class?
You generate a class with the package's Artisan make-style command, then implement your data logic in the up and down methods of that class. Check the README for the exact command signature and any naming or path options. Once written, you execute it with the package's own migrate command rather than the standard schema migrate command.
Does laravel-data-migrations track which data migrations have already run?
Yes. The package records executed data migrations, similar to how Laravel tracks schema migrations, so each data migration runs only once per environment. This makes the changes safe to include in repeatable deploy or CI steps. Rollbacks update that record so a migration can be re-run intentionally after being reversed.
How do I roll back a data migration safely?
Use the package's rollback command with the options it provides to reverse the last batch or a specific data migration, relying on the down method of each class to define the reversal logic. Data rollbacks can be destructive, so always test them against a copy of production data first. Keep a backup or snapshot before running rollbacks against real data.
Can I run data migrations automatically during deployment or on a schedule?
Yes, they are console commands, so they fit naturally into deploy hooks, CI pipelines, and the Laravel scheduler. Because they run separately from php artisan migrate, you control the ordering between structure and data changes explicitly. Use the command's exit code to gate the rest of the pipeline.
What does the --graceful option in laravel-data-migrations 2.0.2 actually do?
Version 2.0.2 adds a --graceful CLI flag, but the release note is a single line that does not describe the behavior. Read the actual diff or changelog to establish whether it suppresses non-zero exit codes, continues past per-item failures, retries transient errors, or downgrades failures to warnings. Do not assume anything about the default until you have confirmed that omitting the flag fully preserves 2.0.1 behavior.
Is it safe to use --graceful in CI pipelines and automated deploys?
Only after you know precisely what it changes. Flags that convert hard failures into silent successes are dangerous in automation because they hide broken data changes. Force a failure with and without the flag, record exit codes and output for your runbook, and adopt the flag selectively for idempotent or retryable invocations only.
How is this different from Laravel database seeders?
Seeders are typically re-run on demand and are not versioned or tracked, which makes them awkward for one-off data changes that must run exactly once in order. Data migrations are versioned, recorded in a tracking table, and rollback-capable, so they behave like schema migrations but for data. Many teams keep seeders for baseline or development fixtures and use data migrations for production data transformations.
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.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums