lib/pg_trunk/operations/foreign_keys/base.rb
# Generate the name for the foreign key using the essential options
# @return [PGTrunk::QualifiedName]
Generate the name for the foreign key using the essential options
Generate the name for the foreign key using the essential options
def generated_name
      return @generated_name if instance_variable_defined?(:@generated_name)
      @generated_name = begin
        return if table.blank? || reference.blank?
        return if primary_key.blank? || columns.blank?
        key_options = to_h.slice(:reference, :columns, :primary_key)
        identifier = "#{table.lean}_#{key_options}_fk"
        hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10)
        PGTrunk::QualifiedName.wrap("fk_rails_#{hashed_identifier}")
      end
    end
def generated_name return @generated_name if instance_variable_defined? ( :@generated_name ) @generated_name = begin return if table . blank? || reference . blank? return if primary_key . blank? || columns . blank? key_options = to_h . slice ( :reference , :columns , :primary_key ) identifier = "#{table.lean}_#{key_options}_fk" hashed_identifier = Digest :: SHA256 . hexdigest ( identifier ) . first ( 10 ) PGTrunk :: QualifiedName . wrap ( "fk_rails_#{hashed_identifier}" ) end end
Generate the name for the foreign key using the essential options
Generate the name for the foreign key using the essential options
None
PGTrunk::QualifiedName