aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
blob: d0b38dff4cd767b4512c8e34c544d861354f361c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module ActiveRecord
  module ConnectionAdapters
    module SQLite3
      module ColumnMethods
        def primary_key(name, type = :primary_key, **options)
          if options.delete(:auto_increment) == true && %i(integer bigint).include?(type)
            type = :primary_key
          end

          super
        end
      end

      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        include ColumnMethods
      end

      class Table < ActiveRecord::ConnectionAdapters::Table
        include ColumnMethods
      end
    end
  end
end