Sha256: 6ce7e4225522d4a2e06c8e3293591b2016c5041db22bec78a62984f32f978ea8
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module ActiveRecord module ConnectionAdapters module PostgreSQL module ColumnDumper def column_spec_for_primary_key(column) spec = {} if column.serial? return unless column.bigint? spec[:id] = ':bigserial' elsif column.type == :uuid spec[:id] = ':uuid' spec[:default] = schema_default(column) || 'nil' else spec[:id] = column.type.inspect spec.merge!(prepare_column_options(column).delete_if { |key, _| [:name, :type, :null].include?(key) }) end spec end # Adds +:array+ option to the default set def prepare_column_options(column) spec = super spec[:array] = 'true' if column.array? spec end # Adds +:array+ as a valid migration key def migration_keys super + [:array] end private def schema_type(column) return super unless column.serial? if column.bigint? 'bigserial' else 'serial' end end def schema_expression(column) super unless column.serial? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-5.0.0.beta2 | lib/active_record/connection_adapters/postgresql/schema_dumper.rb |