Sha256: dd7295dff19dcbdf090f814cd921ba2f0892b5b9f07a207c47fcba15d903d5b5

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module SQLite3
      class SchemaCreation < SchemaCreation # :nodoc:
        private
          def visit_AddForeignKey(o)
            super.dup.tap do |sql|
              sql << " DEFERRABLE INITIALLY #{o.options[:deferrable].to_s.upcase}" if o.deferrable
            end
          end

          def visit_ForeignKeyDefinition(o)
            super.dup.tap do |sql|
              sql << " DEFERRABLE INITIALLY #{o.deferrable.to_s.upcase}" if o.deferrable
            end
          end

          def supports_index_using?
            false
          end

          def add_column_options!(sql, options)
            if options[:collation]
              sql << " COLLATE \"#{options[:collation]}\""
            end

            if as = options[:as]
              sql << " GENERATED ALWAYS AS (#{as})"

              if options[:stored]
                sql << " STORED"
              else
                sql << " VIRTUAL"
              end
            end
            super
          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_creation.rb
activerecord-7.2.2 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.1.2 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.1.1 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.1 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.0 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.0.rc1 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.0.beta3 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.0.beta2 lib/active_record/connection_adapters/sqlite3/schema_creation.rb
activerecord-7.2.0.beta1 lib/active_record/connection_adapters/sqlite3/schema_creation.rb