No documentation
This module has no description. You can help the Ruby on Rails community by adding new notes.
Constants
PostgreSQLColumn = PostgreSQL::Column # :nodoc:
CheckConstraintDefinition = Struct.new(:table_name, :expression, :options) do
def name
options[:name]
end
def validate?
options.fetch(:validate, true)
end
alias validated? validate?
def export_name_on_schema_dump?
!ActiveRecord::SchemaDumper.chk_ignore_pattern.match?(name) if name
end
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
end
ForeignKeyDefinition = Struct.new(:from_table, :to_table, :options) do # :nodoc:
def name
options[:name]
end
def column
options[:column]
end
def primary_key
options[:primary_key] || default_primary_key
end
def on_delete
options[:on_delete]
end
def on_update
options[:on_update]
end
def deferrable
options[:deferrable]
end
def custom_primary_key?
options[:primary_key] != default_primary_key
end
def validate?
options.fetch(:validate, true)
end
alias validated? validate?
def export_name_on_schema_dump?
!ActiveRecord::SchemaDumper.fk_ignore_pattern.match?(name) if name
end
def defined_for?(to_table: nil, validate: nil, **options)
(to_table.nil? || to_table.to_s == self.to_table) &&
(validate.nil? || validate == self.options.fetch(:validate, validate)) &&
options.all? { |k, v| Array(self.options[k]).map(&:to_s) == Array(v).map(&:to_s) }
end
private
def default_primary_key
"id"
end
end
PrimaryKeyDefinition = Struct.new(:name)
CreateIndexDefinition = Struct.new(:index, :algorithm, :if_not_exists)
ChangeColumnDefaultDefinition = Struct.new(:column, :default)
ChangeColumnDefinition = Struct.new(:column, :name)
AddColumnDefinition = Struct.new(:column)
ColumnDefinition = Struct.new(:name, :type, :options, :sql_type) do # :nodoc:
self::OPTION_NAMES = [
:limit,
:precision,
:scale,
:default,
:null,
:collation,
:comment,
:primary_key,
:if_exists,
:if_not_exists
]
def primary_key?
options[:primary_key]
end
(self::OPTION_NAMES - [:primary_key]).each do |option_name|
module_eval <<-CODE, __FILE__, __LINE__ + 1
def #{option_name}
options[:#{option_name}]
end
def #{option_name}=(value)
options[:#{option_name}] = value
end
CODE
end
def aliased_types(name, fallback)
"timestamp" == name ? :datetime : fallback
end
end
Attributes
Show files where this module is defined (82 files)
activerecord/lib/active_record/connection_adapters.rb
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
activerecord/lib/active_record/connection_adapters/schema_cache.rb
activerecord/lib/active_record/connection_adapters/statement_pool.rb
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb
activerecord/lib/active_record/connection_adapters/postgresql/column.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord/lib/active_record/connection_adapters/postgresql/utils.rb
activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb
activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/macaddr.rb
activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb
activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb
activerecord/lib/active_record/connection_adapters/pool_manager.rb
activerecord/lib/active_record/connection_adapters/deduplicable.rb
activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb
activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb
activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
activerecord/lib/active_record/connection_adapters/sqlite3/database_statements.rb
activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb
activerecord/lib/active_record/connection_adapters/sqlite3/column.rb
activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb
activerecord/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb
activerecord/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb
activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb
activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
activerecord/lib/active_record/connection_adapters/pool_config.rb
activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb
activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb
activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb
activerecord/lib/active_record/connection_adapters/mysql/column.rb
activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb
activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb
activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb
activerecord/lib/active_record/connection_adapters/mysql/quoting.rb