Skip to content

Commit

Permalink
Merge pull request #17 from atarihomestar/master
Browse files Browse the repository at this point in the history
fix migration generator to ensure distinct version numbers
  • Loading branch information
Sung Won Cho committed Feb 20, 2016
2 parents 8bf95e1 + e6d8448 commit f4ca9f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/generators/has_friendship/has_friendship_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ def self.source_root
end

def self.next_migration_number(path)
Time.now.utc.strftime("%Y%m%d%H%M%S")
next_num = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
current_num = current_migration_number(path)
next_num += (current_num - next_num + 1) if current_num >= next_num
next_num.to_s
end

def create_migration_file
Expand Down

0 comments on commit f4ca9f3

Please sign in to comment.