clickhouse-activerecord 1.0.10 → 1.0.11

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
  SHA256:
3
- metadata.gz: fcb4b8401a210b2fafb35c9947df32c772b83740102b95b982146c573ae76f12
4
- data.tar.gz: 41e059ab9a032725874117f4d7f18e6e0c22e568aaec142002b2f9bf5400ddac
3
+ metadata.gz: 48c4995d403717ca5d9b4d8bdadbedd4bae8d42cf7dad7f37768d12922ebb032
4
+ data.tar.gz: 01cc522bc62fc1015e66b9239b11bf0e5cf4fa9bc998375e0021130737cacaf3
5
5
  SHA512:
6
- metadata.gz: f6242025f4207c68d8ac1e9a7cb87ede0fcbcbf4f7937b44d9b9e8faff43a121af2cb8c58bbdb2fac0d1959d197efb95e1718968c054ef9e213641fe2da6641a
7
- data.tar.gz: 4a007e48f1f7f3866d90cf5080847d0e6af9dba41e525bdd78890419f9edc0f8484dbd3d83d01529185477210d1878527d85506a65a927970c864e9f7d6a60f4
6
+ metadata.gz: 8ee641fb865778a883b93d56a834ab4c842e3f0531a60c3e6a10278a558b9eddc14a101a2dd96688c983090d5dabfb1d3040f78ff09946facc7f7709cbd81dec
7
+ data.tar.gz: 147bcb2f4c7af96e9d68532de7f0c16f4fda78ac31c63735d12f7f7e04597869d827c7fd58cf72e8adc9750395d12442d6becbcc2d9e534e9819e6eef839f20a
@@ -104,7 +104,8 @@ HEADER
104
104
  raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
105
105
  next if column.name == pk
106
106
  type, colspec = column_spec(column)
107
- tbl.print " t.#{type} #{column.name.inspect}"
107
+ name = column.name =~ (/\./) ? "\"`#{column.name}`\"" : column.name.inspect
108
+ tbl.print " t.#{type} #{name}"
108
109
  tbl.print ", #{format_colspec(colspec)}" if colspec.present?
109
110
  tbl.puts
110
111
  end
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '1.0.10'
2
+ VERSION = '1.0.11'
3
3
  end
@@ -36,10 +36,16 @@ module CoreExtensions
36
36
  connection.insert(im, "#{self.class} Create Rollback Version", primary_key, version)
37
37
  end
38
38
 
39
- def all_versions
39
+ def versions
40
40
  return super unless connection.is_a?(::ActiveRecord::ConnectionAdapters::ClickhouseAdapter)
41
41
 
42
- final.where(active: 1).order(:version).pluck(:version)
42
+ sm = ::Arel::SelectManager.new(arel_table)
43
+ sm.final!
44
+ sm.project(arel_table[primary_key])
45
+ sm.order(arel_table[primary_key].asc)
46
+ sm.where([arel_table['active'].eq(1)])
47
+
48
+ connection.select_values(sm, "#{self.class} Load")
43
49
  end
44
50
  end
45
51
  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: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Odintsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-11 00:00:00.000000000 Z
11
+ date: 2024-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler