laravel-sync-migration icon indicating copy to clipboard operation
laravel-sync-migration copied to clipboard

allow to specify migration file path

Open vesper8 opened this issue 4 years ago • 2 comments

It would be nice if you could specify a single migration file to perform a sync over, rather than allowing the sync command to iterate over dozens of migrations every time

vesper8 avatar Nov 18 '21 15:11 vesper8

PRs are welcome

BSN4 avatar Nov 19 '21 21:11 BSN4

Not a PR but this is how I solved it

    protected $signature = 'migrate:sync {--migration=}';
    
    ...

    public function handle()
    {
        $files = $this->migrator->getMigrationFiles($this->getMigrationPaths());

        foreach ($files as $file) {
            if ($this->option('migration')) {
                if (stripos($file, $this->option('migration')) > -1) {
                    $this->processMigration(file_get_contents($file));
                }
            } else {
                $this->processMigration(file_get_contents($file));
            }
        }
        
        ...
        
    }

vesper8 avatar Nov 19 '21 21:11 vesper8