oil
oil copied to clipboard
Migration numbering should be reviewed, timestamp based maybe?
The problem is very simple to explain. When I am working on a branch and create some migrations, they get numbered. Assume we have a blank projects and on my branch I add the following:
001_create_users
002_create_posts
003_rename_field_name_to_username_in_users
004_create_comments
In the meanwhile, another colleague is working on the master (or dev) branch and also creating the following migrations:
001_create_userposts
002_create_images
When I merge my branch onto the master and then run the migrations from the master, every 'number' inside the name get's executed once. Our workaround for now is renaming the migrations after merging so each number is unique, but this is very tedious.
Is there another way? Rails uses timestamp bases migration names which (almost) never collide, would that not be a better approach?
/cc @pierot