Sha256: b02b512114fdc95ffed39c6152b8b0565ef6acc4b731ff3412163b7fdf6c889f

Contents?: true

Size: 1013 Bytes

Versions: 20

Compression:

Stored size: 1013 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module ColumnDumper # :nodoc:
        # 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) == :bigserial
          end

          def explicit_primary_key_default?(column)
            column.type == :uuid || (column.type == :integer && !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

20 entries across 20 versions & 1 rubygems

Version Path
activerecord-5.1.7 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.7.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.6.2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.6.1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.6 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.5 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.5.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.4 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.4.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.3 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.3.rc3 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.3.rc2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.3.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.2.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.0 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.0.rc2 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.0.rc1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb
activerecord-5.1.0.beta1 lib/active_record/connection_adapters/postgresql/schema_dumper.rb