wp-migrations
wp-migrations copied to clipboard
Remove the dependency on having the date prefix in migration filenames
Related to https://github.com/deliciousbrains/wp-migrations/issues/4#issuecomment-542680642
Realistically there needs to be a better naming structure here. Take Django migrations, for example, migrations are numbered in the order that they should be run. This way, you're able to provide idempotent migrations that run exactly as the developer intended them to be run. You don't get any issues with migrations written on the same day.
E.G
2020_04_27_AddTable.php
and 2020_04_27_AddColumn.php
were created on the same day. AddTable
was created first, and AddColumn
afterwards. You could argue that they should be combined, but they may not have been created at the same time.
In a filesystem, 2020_04_27_AddColumn
would be listed first and likely be run first, causing an error because the table wasn't created.
By this effect, you could enhance the whole migration structure by mapping dependencies for each migration to ensure that the migrations that the current migration being run are dependent on are always run first.
This will allow developers to structure their migrations into directories that are less ambiguous about what sections they relate to.
app/migrations/about/001_CreateTable.php
app/migrations/about/002_AlterColumn.php
app/migrations/contact/001_CreateTable.php