Sha256: 978d8f3558b0551aef735de3bdd2c25f873ab2a2298671c57b5dd10b49b2be88

Contents?: true

Size: 698 Bytes

Versions: 9

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module Audited
  module Generators
    module Migration
      # Implement the required interface for Rails::Generators::Migration.
      def next_migration_number(dirname) # :nodoc:
        next_migration_number = current_migration_number(dirname) + 1
        if timestamped_migrations?
          [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
        else
          "%.3d" % next_migration_number
        end
      end

      private

      def timestamped_migrations?
        (Rails.version >= "7.0") ?
          ::ActiveRecord.timestamped_migrations :
          ::ActiveRecord::Base.timestamped_migrations
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
audited-5.4.2 lib/generators/audited/migration.rb
audited-5.4.1 lib/generators/audited/migration.rb
audited-5.4.0 lib/generators/audited/migration.rb
audited-5.3.3 lib/generators/audited/migration.rb
audited-5.3.2 lib/generators/audited/migration.rb
audited-5.3.1 lib/generators/audited/migration.rb
audited-5.3.0 lib/generators/audited/migration.rb
audited-5.2.0 lib/generators/audited/migration.rb
audited-5.1.0 lib/generators/audited/migration.rb