Skip to content

Commit

Permalink
Merge pull request #134 from lazyatom/patch-1
Browse files Browse the repository at this point in the history
Fix migration generator to support Rails 7.1
  • Loading branch information
ledermann authored Feb 9, 2024
2 parents 1ae0270 + b737eed commit 8f9c377
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/generators/unread/migration/migration_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ def create_migration_file
end

def self.next_migration_number(dirname)
if ActiveRecord::Base.timestamped_migrations
if self.timestamped_migrations?
Time.now.utc.strftime("%Y%m%d%H%M%S")
else
"%.3d" % (current_migration_number(dirname) + 1)
end
end

def self.timestamped_migrations?
(
ActiveRecord::Base.respond_to?(:timestamped_migrations) &&
ActiveRecord::Base.timestamped_migrations
) ||
(
ActiveRecord.respond_to?(:timestamped_migrations) &&
ActiveRecord.timestamped_migrations
)
end
end
end

0 comments on commit 8f9c377

Please sign in to comment.