-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[12.x] Add database dump with data + load #57682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 12.x
Are you sure you want to change the base?
Conversation
|
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
I also think |
|
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. |
|
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. |
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:dumpand 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.