123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::CheckConstraintDefinition

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ::Struct
Instance Chain:
self, ::Struct
Inherits: Struct
  • ::Object
Defined in: activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#export_name_on_schema_dump?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 183

def export_name_on_schema_dump?
  !ActiveRecord::SchemaDumper.chk_ignore_pattern.match?(name) if name
end

#expression (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 173

CheckConstraintDefinition = Struct.new(:table_name, :expression, :options)

#options (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 173

CheckConstraintDefinition = Struct.new(:table_name, :expression, :options)

#table_name (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 173

CheckConstraintDefinition = Struct.new(:table_name, :expression, :options)

#validate?Boolean (readonly) Also known as: #validated?

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 178

def validate?
  options.fetch(:validate, true)
end

#validated? (readonly)

Alias for #validate?.

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 181

alias validated? validate?

Instance Method Details

#defined_for?(name:, expression: nil, validate: nil, **options) ⇒ Boolean

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 187

def defined_for?(name:, expression: nil, validate: nil, **options)
  self.name == name.to_s &&
    (validate.nil? || validate == self.options.fetch(:validate, validate)) &&
    options.all? { |k, v| self.options[k].to_s == v.to_s }
end

#name

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 174

def name
  options[:name]
end