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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/clickhouse-activerecord.gemspec +2 -2
- data/lib/active_record/connection_adapters/clickhouse/schema_statements.rb +5 -1
- data/lib/active_record/connection_adapters/clickhouse_adapter.rb +25 -3
- data/lib/clickhouse-activerecord/version.rb +1 -1
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d313720b1a43f19f51e6fa9e88ef40d136130e9
|
4
|
+
data.tar.gz: e82dbfb65bd38fa50df9304690bd116eef021a70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fed861c69428580cddb00c79656ac7614bd26f5c47cdc0a6e4378b0578f4935aec86430b5523f599a97753be329482a8e766471b505d1fd04961ad98ac0415f
|
7
|
+
data.tar.gz: 581d95bdc952a7be4d5645ea0948011f7c67ca6b145c3607774a9770997382fa36279b6029b4128d43909948658b956db64d0d185351eee1f6f756cbaa36bd7c
|
data/CHANGELOG.md
CHANGED
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: `
|
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', '
|
27
|
-
spec.add_runtime_dependency 'activerecord', '
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
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
|