Sha256: 9b6db084cc384eb9a7189f97b938eea44cce4151f4b519de8bcf20d4e87a0e0f

Contents?: true

Size: 1013 Bytes

Versions: 2

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true

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

module Doorkeeper
  # Generates migration with which drops NOT NULL constraint and allows not
  # to bloat the database with redundant secret value.
  #
  class RemoveApplicationSecretNotNullConstraint < ::Rails::Generators::Base
    include ::Rails::Generators::Migration
    source_root File.expand_path("templates", __dir__)
    desc "Removes NOT NULL constraint for OAuth2 applications."

    def enable_polymorphic_resource_owner
      migration_template(
        "remove_applications_secret_not_null_constraint.rb.erb",
        "db/migrate/remove_applications_secret_not_null_constraint.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

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb
doorkeeper-5.8.0 lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb