Feature Request: Migration dependencies
A constant headache, particularly with testing, is running a migration that modifies a table from another migration but that table isn't created yet because the other migration did not run. I would like to see either a "dependency" or "preliminary" migration feature: the former skipping the migration if its parent has not run, the latter running the parent on-demand if it has not yet.
@MGatner Do you really need this?
A constant headache, particularly with testing, is running a migration that modifies a table from another migration but that table isn't created yet because the other migration did not run.
I don't understand why this happens.
All migrations have an ordinal number. How can I skip the creation if you are updating?
It's been a while since I wrote this but I believe the issue is cross-library. For example, if I want to add a firstname column to my Shield users then in app/Database/Migrations/ I will create a new migration with UPDATE TABLE ADD COLUMN. This will fail, though, if the Shield migrations have not been run - e.g. under testing if I set $namespace = 'App'. This requires the developer either to run all migrations for every test, or keep track of which migrations have these "dependencies".
At this point I think effort would probably be better spent on adding a database state snapshot to our testing workflow. I started work towards this in my Schemas library in the form of "database-structure-to-migration" but never finished. I think it would be a very helpful feature generally, and a huge performance and ease-of-use improvement for testing.