Open westonganger opened 9 years ago
@westonganger PR's are welcome. All you need to do is check if the file already exists before printing this message.
I misunderstood what this was supposed to do. I thought it automatically created a migration file. The best solution I came up with was this but its probably not great and im not sure if using system commands are frowned upon and it will probably slow down the command somewhat significantly.
`bundle exec rake db:migrate:status | grep 'Add missing indexes'`.scan(/Add missing indexes/).count
I would then take that number+1 and append it to the migration name. I also may have to check for existance of bundler gem too.
Let me know what you think, if I shouldn't bother then you can just close the issue.
@westonganger I think that the idea of getting the count is cool, but this way we will depend on grep. I think that's better to use ruby's File API to check if we already have any migration. What do you think?
Yeah that would be better I just whipped it up quickly. Now that we are ensuring its an unused name is it desired to actually run rails g migration AddMissingIndexes3 and fill the file with the information?
I have previously run
rails g migration AddMissingIndexes
I wanted to run it again but there is a name clash with the previous migration. Would be helpful it it automatically added a number to the name or something or had an options to manually change the name