activerecord-turntable 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6d1d03f8216a73b1e732c4c1c22c6eda6d9843661121a2c5c85543ca6da51e32
         | 
| 4 | 
            +
              data.tar.gz: e71f85959d36f0dbb806ed287ba9137a45c30645fdfafbf6d845799ab3de3fc0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2bffbb3be5a6d1ccd5f4fb69a7a6c4af0c41f63f56188e6aee394979d9310f37646243ef3e3b035bf28767a2c25b70d4b10bda9544f0070b232364834476a61f
         | 
| 7 | 
            +
              data.tar.gz: 72c016be4117d12955f448aba07d3f02c2262fb590e8c3b2361aeae9a307aab3d588520e28da8d3e6cb421b9649e751a05ff901fdfe4a6349577f7505730b466
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
| @@ -3,10 +3,9 @@ module ActiveRecord::Turntable | |
| 3 3 | 
             
                # activerecord-import extension
         | 
| 4 4 | 
             
                module ActiverecordImportExt
         | 
| 5 5 | 
             
                  # @note override for sequencer injection
         | 
| 6 | 
            -
                  # @see https://github.com/zdennis/activerecord-import/blob/ | 
| 6 | 
            +
                  # @see https://github.com/zdennis/activerecord-import/blob/85586d052822b8d498ced6c900251997edbeee04/lib/activerecord-import/import.rb#L848-L883
         | 
| 7 7 | 
             
                  private def values_sql_for_columns_and_attributes(columns, array_of_attributes)
         | 
| 8 8 | 
             
                    connection_memo = connection
         | 
| 9 | 
            -
                    type_caster_memo = type_caster if respond_to?(:type_caster)
         | 
| 10 9 |  | 
| 11 10 | 
             
                    array_of_attributes.map do |arr|
         | 
| 12 11 | 
             
                      my_values = arr.each_with_index.map do |val, j|
         | 
| @@ -15,12 +14,16 @@ module ActiveRecord::Turntable | |
| 15 14 | 
             
                        # be sure to query sequence_name *last*, only if cheaper tests fail, because it's costly
         | 
| 16 15 | 
             
                        if val.nil? && column.name == primary_key && !sequence_name.blank?
         | 
| 17 16 | 
             
                          if sequencer_enabled?
         | 
| 18 | 
            -
                             | 
| 17 | 
            +
                            self.next_sequence_value
         | 
| 19 18 | 
             
                          else
         | 
| 20 19 | 
             
                            connection_memo.next_value_for_sequence(sequence_name)
         | 
| 21 20 | 
             
                          end
         | 
| 21 | 
            +
                        elsif val.respond_to?(:to_sql)
         | 
| 22 | 
            +
                          "(#{val.to_sql})"
         | 
| 22 23 | 
             
                        elsif column
         | 
| 23 | 
            -
                           | 
| 24 | 
            +
                          type = type_for_attribute(column.name)
         | 
| 25 | 
            +
                          val = type.type == :boolean ? type.cast(val) : type.serialize(val)
         | 
| 26 | 
            +
                          connection_memo.quote(val)
         | 
| 24 27 | 
             
                        end
         | 
| 25 28 | 
             
                      end
         | 
| 26 29 | 
             
                      "(#{my_values.join(',')})"
         | 
| @@ -31,6 +34,8 @@ module ActiveRecord::Turntable | |
| 31 34 | 
             
                begin
         | 
| 32 35 | 
             
                  require "activerecord-import"
         | 
| 33 36 | 
             
                  require "activerecord-import/base"
         | 
| 37 | 
            +
                  require "activerecord-import/active_record/adapters/mysql2_adapter"
         | 
| 38 | 
            +
                  ActiveRecord::Turntable::ConnectionProxy.include(ActiveRecord::Import::Mysql2Adapter)
         | 
| 34 39 | 
             
                  (class << ActiveRecord::Base; self; end).prepend(ActiverecordImportExt)
         | 
| 35 40 | 
             
                rescue LoadError # rubocop:disable Lint/HandleExceptions
         | 
| 36 41 | 
             
                end
         | 
| @@ -11,8 +11,8 @@ module ActiveRecord::Turntable | |
| 11 11 | 
             
                  yield proxy
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 | 
            -
                delegate :connected?, :automatic_reconnect, :automatic_reconnect=, :checkout_timeout, :dead_connection_timeout,
         | 
| 15 | 
            -
                         :spec, :connections, :size, :reaper, :table_exists?, :query_cache_enabled, :enable_query_cache!, to: :proxy
         | 
| 14 | 
            +
                delegate :connected?, :checkout_timeout, :automatic_reconnect, :automatic_reconnect=, :checkout_timeout, :checkout_timeout=, :dead_connection_timeout,
         | 
| 15 | 
            +
                         :spec, :connections, :size, :reaper, :table_exists?, :query_cache_enabled, :enable_query_cache!, :schema_cache, :schema_cache=, to: :proxy
         | 
| 16 16 |  | 
| 17 17 | 
             
                %w(columns_hash column_defaults primary_keys).each do |name|
         | 
| 18 18 | 
             
                  define_method(name.to_sym) do
         | 
| @@ -30,18 +30,32 @@ module ActiveRecord::Turntable | |
| 30 30 | 
             
                  connection_pools_list.any?(&:active_connection?)
         | 
| 31 31 | 
             
                end
         | 
| 32 32 |  | 
| 33 | 
            -
                %w | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 33 | 
            +
                %w[
         | 
| 34 | 
            +
                  clear_active_connections!
         | 
| 35 | 
            +
                  clear_all_connections!
         | 
| 36 | 
            +
                  clear_reloadable_connections!
         | 
| 37 | 
            +
                  clear_stale_cached_connections!
         | 
| 38 | 
            +
                  disconnect
         | 
| 39 | 
            +
                  disconnect!
         | 
| 40 | 
            +
                  flush!
         | 
| 41 | 
            +
                  reap
         | 
| 42 | 
            +
                  release_connection
         | 
| 43 | 
            +
                  verify_active_connections!
         | 
| 44 | 
            +
                ].each do |name|
         | 
| 40 45 | 
             
                  define_method(name.to_sym) do
         | 
| 41 46 | 
             
                    connection_pools_list.each { |cp| cp.public_send(name.to_sym) }
         | 
| 42 47 | 
             
                  end
         | 
| 43 48 | 
             
                end
         | 
| 44 49 |  | 
| 50 | 
            +
                %w[
         | 
| 51 | 
            +
                  clear_reloadable_connections
         | 
| 52 | 
            +
                  flush
         | 
| 53 | 
            +
                ].each do |name|
         | 
| 54 | 
            +
                  define_method(name.to_sym) do |args|
         | 
| 55 | 
            +
                    connection_pools_list.each { |cp| cp.public_send(name.to_sym, *args) }
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 45 59 | 
             
                def discard!
         | 
| 46 60 | 
             
                  # Nothing to do
         | 
| 47 61 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activerecord-turntable
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - gussan
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2018- | 
| 12 | 
            +
            date: 2018-06-11 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activerecord
         |