kitloong / laravel-migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
2.43k stars 269 forks source link

Ignore vendor migrations #182

Closed Synchro closed 11 months ago

Synchro commented 1 year ago

When I generate a set of migrations with this package, it does so solely from the database. As far as my own schema goes, that's fine, but it runs into a problem with vendor-supplied migrations, for example from Laravel Passport or Nova. I can wrap "table exists" conditions around my own migrations, but I can't do it for vendor-provided ones.

I can ask packages to publish their migrations so I can amend them, but not all packages allow that, for example Nova doesn't. For the moment, I have worked around this by letting the migration generation run, then manually editing out the changes that duplicate what is in vendor migrations, which is a fiddly process.

Is there a way to suppress the re-creation of schema changes made by vendor-supplied migrations rather than my own?

kitloong commented 1 year ago

Hi @Synchro , thank you for raising the issue.

Hmm... It seems like this could be a bit challenging. I assume the generator needs to scan for vendor-supplied migrations to get a list of table names and determine what to handle next.

If the vendor-supplied migrations structure is consistent, and it should be, this feature should be workable.

I'm not familiar with Nova, so I may need some guidance or assistance from you when the time comes to test it.

I can begin by investigating Passport and other packages to implement this feature.