Skip to content
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

allow to specify migration file path #10

Open
vesper8 opened this issue Nov 18, 2021 · 2 comments
Open

allow to specify migration file path #10

vesper8 opened this issue Nov 18, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@vesper8
Copy link

vesper8 commented Nov 18, 2021

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

@BSN4
Copy link
Contributor

BSN4 commented Nov 19, 2021

PRs are welcome

@BSN4 BSN4 closed this as completed Nov 19, 2021
@BSN4 BSN4 reopened this Nov 19, 2021
@BSN4 BSN4 added the enhancement New feature or request label Nov 19, 2021
@vesper8
Copy link
Author

vesper8 commented Nov 19, 2021

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));
            }
        }
        
        ...
        
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants