From c4a5d3c1d1ed9b7bd451f898442a7d71cbc72de7 Mon Sep 17 00:00:00 2001 From: ajmauricio Date: Tue, 12 Dec 2023 15:54:41 -0800 Subject: [PATCH] Fix next migration number for rails 7 --- lib/generators/punching_bag/punching_bag_generator.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/generators/punching_bag/punching_bag_generator.rb b/lib/generators/punching_bag/punching_bag_generator.rb index a068f3e..bf85029 100644 --- a/lib/generators/punching_bag/punching_bag_generator.rb +++ b/lib/generators/punching_bag/punching_bag_generator.rb @@ -6,12 +6,8 @@ class PunchingBagGenerator < Rails::Generators::Base source_root File.join(File.dirname(__FILE__), 'templates') def self.next_migration_number(dirname) - sleep 1 - if ActiveRecord::Base.timestamped_migrations - Time.now.utc.strftime("%Y%m%d%H%M%S") - else - "%.3d" % (current_migration_number(dirname) + 1) - end + next_migration_number = current_migration_number(dirname) + 1 + ActiveRecord::Migration.next_migration_number(next_migration_number) end def create_migration_file