Sha256: 7dfbce74c08e85b63fcf812318731c83fa2e20bc3c297dda8a78d98cce89a351

Contents?: true

Size: 915 Bytes

Versions: 10

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module SQLite3
      class SchemaDumper < ConnectionAdapters::SchemaDumper # :nodoc:
        private
          def default_primary_key?(column)
            schema_type(column) == :integer
          end

          def explicit_primary_key_default?(column)
            column.bigint?
          end

          def prepare_column_options(column)
            spec = super

            if @connection.supports_virtual_columns? && column.virtual?
              spec[:as] = extract_expression_for_virtual_column(column)
              spec[:stored] = column.virtual_stored?
              spec = { type: schema_type(column).inspect }.merge!(spec)
            end

            spec
          end

          def extract_expression_for_virtual_column(column)
            column.default_function.inspect
          end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
activerecord-7.2.2.1 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.2 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.1.2 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.1.1 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.1 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.0 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.0.rc1 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.0.beta3 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.0.beta2 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
activerecord-7.2.0.beta1 lib/active_record/connection_adapters/sqlite3/schema_dumper.rb