Sha256: 8034596ecb2e708fa7e58af8f6358b565fa6b4ba2e30d8fae7c8f6445df1d423

Contents?: true

Size: 991 Bytes

Versions: 23

Compression:

Stored size: 991 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module SQLite3
      # = Active Record SQLite3 Adapter \Table Definition
      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        def change_column(column_name, type, **options)
          name = column_name.to_s
          @columns_hash[name] = nil
          column(name, type, **options)
        end

        def references(*args, **options)
          super(*args, type: :integer, **options)
        end
        alias :belongs_to :references

        def new_column_definition(name, type, **options) # :nodoc:
          case type
          when :virtual
            type = options[:type]
          end

          super
        end

        private
          def integer_like_primary_key_type(type, options)
            :primary_key
          end

          def valid_column_definition_options
            super + [:as, :type, :stored]
          end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
activerecord-8.0.1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-8.0.0.1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.2.1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-8.0.0 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.2 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-8.0.0.rc2 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.1.2 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-8.0.0.rc1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.1.1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-8.0.0.beta1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha9 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha8 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha7 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha4 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha3 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha2 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
omg-activerecord-8.0.0.alpha1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.0 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
activerecord-7.2.0.rc1 lib/active_record/connection_adapters/sqlite3/schema_definitions.rb