Sha256: e6134f67d2f3ec0be87cf93178de4e34986853b84739ae96b0dac3271fc82e22

Contents?: true

Size: 825 Bytes

Versions: 13

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

require "rails/generators"
require "rails/generators/active_record"

module Doorkeeper
  # Copies main Doorkeeper migration into parent Rails application.
  #
  class MigrationGenerator < ::Rails::Generators::Base
    include ::Rails::Generators::Migration
    source_root File.expand_path("templates", __dir__)
    desc "Installs Doorkeeper migration file."

    def install
      migration_template(
        "migration.rb.erb",
        "db/migrate/create_doorkeeper_tables.rb",
        migration_version: migration_version
      )
    end

    def self.next_migration_number(dirname)
      ActiveRecord::Generators::Base.next_migration_number(dirname)
    end

    private

    def migration_version
      "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
doorkeeper-5.1.2 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.6 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.1.1 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.5 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.4 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.3 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.2 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.1 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.0 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.0.rc3 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.0.rc2 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.2.0.rc1 lib/generators/doorkeeper/migration_generator.rb
doorkeeper-5.1.0 lib/generators/doorkeeper/migration_generator.rb