clickhouse-activerecord 0.3.5 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7b2fb3282fdff192d0cec9cb19a68ba70d02d83
4
- data.tar.gz: 50dea626b278f9ac8a33ea95d300a5d440fa229a
3
+ metadata.gz: 1d313720b1a43f19f51e6fa9e88ef40d136130e9
4
+ data.tar.gz: e82dbfb65bd38fa50df9304690bd116eef021a70
5
5
  SHA512:
6
- metadata.gz: 06a3b3ae02ca8e2e60974109f1ead35743340b8e12beefa28134cadeeff4df753db044da60e25af007a5e14abda14695fc1725d5b86aa5432dce7f642d2004ab
7
- data.tar.gz: 9d8215272de3a2b9c0bc2d4671cc22d769acdf1e3f8c32ea8d685c28a32be5838bb28dc7c77a8c4bbdaa7960df1537bf0aad7f8db7571c07793c85a64fbcb696
6
+ metadata.gz: 8fed861c69428580cddb00c79656ac7614bd26f5c47cdc0a6e4378b0578f4935aec86430b5523f599a97753be329482a8e766471b505d1fd04961ad98ac0415f
7
+ data.tar.gz: 581d95bdc952a7be4d5645ea0948011f7c67ca6b145c3607774a9770997382fa36279b6029b4128d43909948658b956db64d0d185351eee1f6f756cbaa36bd7c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### Version 0.3.6 (Sep 2, 2019)
2
+
3
+ * Support Rails 6.0
4
+ * Fix relation `last` method
5
+
1
6
  ### Version 0.3.4 (Jun 28, 2019)
2
7
 
3
8
  * Fix DateTime sql format without microseconds for Rails 5.2
data/README.md CHANGED
@@ -105,7 +105,7 @@ ActionView.maximum(:date)
105
105
 
106
106
  Donations to this project are going directly to [PNixx](https://github.com/PNixx), the original author of this project:
107
107
 
108
- * BTC address: `1Lx2gaJtzfF2dxGFxB65YtY5kNY9xUi6ia`
108
+ * BTC address: `1H3rhpf7WEF5JmMZ3PVFMQc7Hm29THgUfN`
109
109
  * ETH address: `0x6F094365A70fe7836A633d2eE80A1FA9758234d5`
110
110
  * XMR address: `42gP71qLB5M43RuDnrQ3vSJFFxis9Kw9VMURhpx9NLQRRwNvaZRjm2TFojAMC8Fk1BQhZNKyWhoyJSn5Ak9kppgZPjE17Zh`
111
111
 
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'bundler', '~> 1.13', '>= 1.13.4'
27
- spec.add_runtime_dependency 'activerecord', '~> 5.2'
26
+ spec.add_runtime_dependency 'bundler', '>= 1.13.4'
27
+ spec.add_runtime_dependency 'activerecord', '>= 5.2'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.15'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -130,7 +130,11 @@ module ActiveRecord
130
130
  default = field[3]
131
131
  default_value = extract_value_from_default(default)
132
132
  default_function = extract_default_function(default_value, default)
133
- ClickhouseColumn.new(field[0], default_value, type_metadata, field[1].include?('Nullable'), table_name, default_function)
133
+ if ActiveRecord::version >= Gem::Version.new('6')
134
+ ClickhouseColumn.new(field[0], default_value, type_metadata, field[1].include?('Nullable'), default_function)
135
+ else
136
+ ClickhouseColumn.new(field[0], default_value, type_metadata, field[1].include?('Nullable'), table_name, default_function)
137
+ end
134
138
  end
135
139
 
136
140
  protected
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'clickhouse-activerecord/arel/visitors/to_sql'
4
4
  require 'clickhouse-activerecord/arel/table'
5
- require 'active_record/connection_adapters/abstract_adapter'
6
5
  require 'active_record/connection_adapters/clickhouse/oid/date'
7
6
  require 'active_record/connection_adapters/clickhouse/oid/date_time'
8
7
  require 'active_record/connection_adapters/clickhouse/oid/big_integer'
@@ -31,6 +30,21 @@ module ActiveRecord
31
30
  end
32
31
  end
33
32
 
33
+ class Relation
34
+
35
+ # Replace for only ClickhouseAdapter
36
+ def reverse_order!
37
+ orders = order_values.uniq
38
+ orders.reject!(&:blank?)
39
+ if self.connection.is_a?(ConnectionAdapters::ClickhouseAdapter) && orders.empty? && !primary_key
40
+ self.order_values = %w(date created_at).select {|c| column_names.include?(c) }.map{|c| arel_attribute(c).desc }
41
+ else
42
+ self.order_values = reverse_sql_order(orders)
43
+ end
44
+ self
45
+ end
46
+ end
47
+
34
48
  module TypeCaster
35
49
  class Map
36
50
  def is_view
@@ -84,7 +98,11 @@ module ActiveRecord
84
98
  @config = config
85
99
  @debug = debug
86
100
 
87
- @prepared_statements = false
101
+ if ActiveRecord::version >= Gem::Version.new('6')
102
+ @prepared_statement_status = Concurrent::ThreadLocalVar.new(false)
103
+ else
104
+ @prepared_statements = false
105
+ end
88
106
 
89
107
  connect
90
108
  end
@@ -145,7 +163,11 @@ module ActiveRecord
145
163
  end
146
164
 
147
165
  def column_name_for_operation(operation, node) # :nodoc:
148
- column_name_from_arel_node(node)
166
+ if ActiveRecord::version >= Gem::Version.new('6')
167
+ visitor.compile(node)
168
+ else
169
+ column_name_from_arel_node(node)
170
+ end
149
171
  end
150
172
 
151
173
  # Executes insert +sql+ statement in the context of this connection using
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.8'
3
3
  end
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clickhouse-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Odintsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-01 00:00:00.000000000 Z
11
+ date: 2019-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.13'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 1.13.4
@@ -24,9 +21,6 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.13'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: 1.13.4
@@ -34,14 +28,14 @@ dependencies:
34
28
  name: activerecord
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: '5.2'
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - "~>"
38
+ - - ">="
45
39
  - !ruby/object:Gem::Version
46
40
  version: '5.2'
47
41
  - !ruby/object:Gem::Dependency