Skip to content

Conversation

@barryvdh
Copy link
Contributor

@barryvdh barryvdh commented Nov 5, 2025

The code is mostly in place, but we only dump schema now. We could extend this to include data, so we can just do php artisan db:dump and dump the entire database.
Optionally we could then create db:load <file> to quickly import an entire file.

Status: work in progress. I think most drivers are similar, just an optional flag to include data or not.

@barryvdh barryvdh marked this pull request as draft November 5, 2025 15:56
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

* @return void
*/
public function dump(Connection $connection, $path)
public function dump(Connection $connection, $path, $withData = false)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would rename this to $hasData

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to a setting on the Schema, like the migration table.

@sytheveenje
Copy link

I also think dump might confuse people who are new to web development, I would suggest calling the command db:export to be more descriptive and consistent with the optional db:import.

@barryvdh
Copy link
Contributor Author

I think 'dump' is used more in the framework, there is also a 'schema:dump' command. Maybe import should be 'load', as it's used in the core now.

I added a basic load command, but we would probably need to drop the database instead of just loading it in.

@barryvdh barryvdh changed the title Add database dump with data [12.x] Add database dump with data Nov 19, 2025
@barryvdh barryvdh changed the title [12.x] Add database dump with data [12.x] Add database dump with data + load Nov 19, 2025
@barryvdh barryvdh marked this pull request as ready for review November 19, 2025 14:26
@barryvdh
Copy link
Contributor Author

Added the drop, but not sure if --drop should be the default though.

Also added Postgres and SQLite, did some basic testing and seems to work, but might need some more tweaking of parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants