fix: makes sure unique and sequential date
parent
214223750b
commit
9de85d0814
|
@ -7,14 +7,18 @@ module Rating
|
||||||
desc 'creates Rating migration'
|
desc 'creates Rating migration'
|
||||||
|
|
||||||
def create_migration
|
def create_migration
|
||||||
template 'db/migrate/create_rating_table.rb', "db/migrate/#{timestamp}_create_rating_table.rb"
|
template 'db/migrate/create_rating_table.rb', "db/migrate/#{timestamp(0)}_create_rating_table.rb"
|
||||||
template 'db/migrate/create_rate_table.rb', "db/migrate/#{timestamp}_create_rate_table.rb"
|
template 'db/migrate/create_rate_table.rb', "db/migrate/#{timestamp(1)}_create_rate_table.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def timestamp
|
def time
|
||||||
Time.current.strftime '%Y%m%d%H%M%S'
|
@time ||= Time.current
|
||||||
|
end
|
||||||
|
|
||||||
|
def timestamp(seconds)
|
||||||
|
(time + seconds.seconds).strftime '%Y%m%d%H%M%S'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue