Skip to content

Commit 08cbfd3

Browse files
committed
✨ add --export-schema key to run:migration command
Signed-off-by: otengkwame <[email protected]>
1 parent 04fadc2 commit 08cbfd3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Core/core/Console/Console.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,29 @@ protected static function runMigration(...$args)
889889
exit;
890890
}
891891

892+
if ($key === '--export-schema' || $key === '--xs') {
893+
894+
$removeTables = '';
895+
$filename = date('Y-m-d-His');
896+
897+
$command = Console::phpCommand() . 'migration/exportSchema/'.$filename;
898+
899+
if (isset($args[1]) && isset($steps[0])) {
900+
$filename = ($steps[1]) ?: $filename;
901+
$command = Console::phpCommand() . 'migration/exportSchema/'.$filename;
902+
}
903+
904+
if (isset($args[2]) && !empty($args[2])) {
905+
$list = explode('=', $args[2]);
906+
$removeTables = str_replace(',','__', $list[1]);
907+
$filename = $steps[1];
908+
$command = Console::phpCommand() . 'migration/exportSchema/'.$filename.'/'.$removeTables;
909+
}
910+
911+
static::runSystemCommand($command);
912+
exit;
913+
}
914+
892915
if ($key != null ) {
893916
$steps = explode('=', $key);
894917
}

0 commit comments

Comments
 (0)