Sha256: 3fdf4a2f06cfb0825617e8ec18b772a888223cd39ed9546b4811725bfc4ebac7

Contents?: true

Size: 1016 Bytes

Versions: 31

Compression:

Stored size: 1016 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module ColumnDumper
        def column_spec_for_primary_key(column)
          spec = super
          if schema_type(column) == :uuid
            spec[:default] ||= 'nil'
          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 default_primary_key?(column)
          schema_type(column) == :serial
        end

        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

31 entries across 31 versions & 4 rubygems

Version Path
activerecord-5.0.7.2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.7.1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.7 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.6 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.6.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.5 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.5.rc2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.5.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.4 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.4.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.3 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.0.2.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/schema_dumper.rb