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

Remove the dependency on having the date prefix in migration filenames #5

Open
polevaultweb opened this issue Oct 16, 2019 · 1 comment

Comments

@polevaultweb
Copy link
Member

Related to #4 (comment)

@Llanilek
Copy link
Contributor

Llanilek commented Apr 27, 2020

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

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

No branches or pull requests

2 participants