clickhouse-activerecord 0.3.4 → 0.3.5

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
- SHA256:
3
- metadata.gz: 1b9461371fc0031e2d5f70577857979c6ab9f210028c733a5d1296c22157527c
4
- data.tar.gz: b3fb5414957d5c4b9ae3cfe32de5c3f292ef82ba390ac8dea45466663e081733
2
+ SHA1:
3
+ metadata.gz: f7b2fb3282fdff192d0cec9cb19a68ba70d02d83
4
+ data.tar.gz: 50dea626b278f9ac8a33ea95d300a5d440fa229a
5
5
  SHA512:
6
- metadata.gz: b72edc5f389e47bc3e6e95bb7ea3e7b239bf35a0d208e721b0fcdc82c6c9e90b68719d0c3e3dc28daf99cea1ee8a053f0ca83173be6dbb9212946f3fc6a30994
7
- data.tar.gz: 610bd1ee31541e875f78a2339bbaff8f90f77074a31017f06d8971d9bc00cc27a13c2bda7f9ef2cde2643d7fb971c904aea76bf59181f78af93b5d1597b5f4b8
6
+ metadata.gz: 06a3b3ae02ca8e2e60974109f1ead35743340b8e12beefa28134cadeeff4df753db044da60e25af007a5e14abda14695fc1725d5b86aa5432dce7f642d2004ab
7
+ data.tar.gz: 9d8215272de3a2b9c0bc2d4671cc22d769acdf1e3f8c32ea8d685c28a32be5838bb28dc7c77a8c4bbdaa7960df1537bf0aad7f8db7571c07793c85a64fbcb696
@@ -1,3 +1,10 @@
1
+ ### Version 0.3.4 (Jun 28, 2019)
2
+
3
+ * Fix DateTime sql format without microseconds for Rails 5.2
4
+ * Support ssl connection
5
+ * Migration support
6
+ * Rake tasks for create / drop database
7
+
1
8
  ### Version 0.3.0 (Nov 27, 2018)
2
9
 
3
10
  * Support materialized view
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'clickhouse-activerecord/arel/visitors/to_sql'
4
+ require 'clickhouse-activerecord/arel/table'
4
5
  require 'active_record/connection_adapters/abstract_adapter'
5
6
  require 'active_record/connection_adapters/clickhouse/oid/date'
6
7
  require 'active_record/connection_adapters/clickhouse/oid/date_time'
@@ -30,6 +31,14 @@ module ActiveRecord
30
31
  end
31
32
  end
32
33
 
34
+ module TypeCaster
35
+ class Map
36
+ def is_view
37
+ types.is_view
38
+ end
39
+ end
40
+ end
41
+
33
42
  module ModelSchema
34
43
  module ClassMethods
35
44
  def is_view
@@ -39,6 +48,11 @@ module ActiveRecord
39
48
  def is_view=(value)
40
49
  @is_view = value
41
50
  end
51
+
52
+ def arel_table # :nodoc:
53
+ @arel_table ||= ClickhouseActiverecord::Arel::Table.new(table_name, type_caster: type_caster)
54
+ end
55
+
42
56
  end
43
57
  end
44
58
 
@@ -130,6 +144,10 @@ module ActiveRecord
130
144
  value.to_s(:db)
131
145
  end
132
146
 
147
+ def column_name_for_operation(operation, node) # :nodoc:
148
+ column_name_from_arel_node(node)
149
+ end
150
+
133
151
  # Executes insert +sql+ statement in the context of this connection using
134
152
  # +binds+ as the bind substitutes. +name+ is logged along with
135
153
  # the executed +sql+ statement.
@@ -0,0 +1,9 @@
1
+ module ClickhouseActiverecord
2
+ module Arel
3
+ class Table < ::Arel::Table
4
+ def is_view
5
+ type_caster.is_view
6
+ end
7
+ end
8
+ end
9
+ end
@@ -6,13 +6,12 @@ module ClickhouseActiverecord
6
6
  class ToSql < ::Arel::Visitors::ToSql
7
7
 
8
8
  def aggregate(name, o, collector)
9
- # todo how get model class from request? This method works with only rails 4.2.
10
9
  # replacing function name for materialized view
11
- # if o.expressions.first && o.expressions.first != '*' && !o.expressions.first.is_a?(String) && o.expressions.first.relation && o.expressions.first.relation.engine && o.expressions.first.relation.engine.is_view
12
- # super("#{name.downcase}Merge", o, collector)
13
- # else
10
+ if o.expressions.first && o.expressions.first != '*' && !o.expressions.first.is_a?(String) && o.expressions.first.relation&.is_view
11
+ super("#{name.downcase}Merge", o, collector)
12
+ else
14
13
  super
15
- # end
14
+ end
16
15
  end
17
16
 
18
17
  end
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clickhouse-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
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-06-28 00:00:00.000000000 Z
11
+ date: 2019-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,6 +126,7 @@ files:
126
126
  - lib/active_record/connection_adapters/clickhouse/schema_statements.rb
127
127
  - lib/active_record/connection_adapters/clickhouse_adapter.rb
128
128
  - lib/clickhouse-activerecord.rb
129
+ - lib/clickhouse-activerecord/arel/table.rb
129
130
  - lib/clickhouse-activerecord/arel/visitors/to_sql.rb
130
131
  - lib/clickhouse-activerecord/railtie.rb
131
132
  - lib/clickhouse-activerecord/schema_dumper.rb
@@ -152,7 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
155
  requirements: []
155
- rubygems_version: 3.0.1
156
+ rubyforge_project:
157
+ rubygems_version: 2.5.2.3
156
158
  signing_key:
157
159
  specification_version: 4
158
160
  summary: ClickHouse ActiveRecord