framework icon indicating copy to clipboard operation
framework copied to clipboard

Include by default the DumpCommand for Database component

Open dmouse opened this issue 4 years ago • 2 comments

useful command to consolidate the whole migrations in one file ;)

dmouse avatar Jan 21 '22 00:01 dmouse

@nunomaduro, what are your thoughts on this? 🤔 Personally I've never used this command so not sure.

owenvoke avatar Jan 31 '22 16:01 owenvoke

there are one problem, if you pack the dump file in a phar and then you run the migration cmd, this cause an error because the migration cmd execute a (in mysql case) mysql PARAMS < phar://path/dump-file.dump.

So the problem is because the LARAVEL_LOAD_PATH use the path in the phar file and is not accessible from the external execution.

my first idea is create a copy of the dump file in a tmp file accessible externally but not sure how to address this.

the migration trace route:

Calculate the dump path https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Console/Migrations/MigrateCommand.php#L175

execute the load method base on the current db engine https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Console/Migrations/MigrateCommand.php#L145

end execute a shell command to import the db dump https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Schema/MySqlSchemaState.php#L72

dmouse avatar Feb 02 '22 04:02 dmouse

No plans for now.

nunomaduro avatar Apr 24 '24 17:04 nunomaduro