Sha256: a6fb86ad68e040f6915dc8c6c0fca482a1760fa8b5cdf9bdc38e60ed393999e7

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module SQLite3
      class Column < ConnectionAdapters::Column # :nodoc:
        attr_reader :rowid

        def initialize(*, auto_increment: nil, rowid: false, **)
          super
          @auto_increment = auto_increment
          @rowid = rowid
        end

        def auto_increment?
          @auto_increment
        end

        def auto_incremented_by_db?
          auto_increment? || rowid
        end

        def init_with(coder)
          @auto_increment = coder["auto_increment"]
          super
        end

        def encode_with(coder)
          coder["auto_increment"] = @auto_increment
          super
        end

        def ==(other)
          other.is_a?(Column) &&
            super &&
            auto_increment? == other.auto_increment?
        end
        alias :eql? :==

        def hash
          Column.hash ^
            super.hash ^
            auto_increment?.hash ^
            rowid.hash
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.5.1 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.5 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.4.2 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.4.1 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.4 lib/active_record/connection_adapters/sqlite3/column.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/sqlite3/column.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.3.4 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.3.2 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.3.1 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.3 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.2 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.1 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.0 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.0.rc2 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.0.rc1 lib/active_record/connection_adapters/sqlite3/column.rb
activerecord-7.1.0.beta1 lib/active_record/connection_adapters/sqlite3/column.rb