clickhouse-activerecord 1.0.7 → 1.0.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
  SHA256:
3
- metadata.gz: 17575531d9c1ae85c10c20230bb78014f9f0e07affe672b683b66651e37af812
4
- data.tar.gz: 14ac2cfb7e6cfa344cf2284a76082e5476e08cfe77a499695157e09c58cd7765
3
+ metadata.gz: 77b149946e335300ac60c931d1318dd2d3a460127b27f3af8722397177e6153e
4
+ data.tar.gz: cd77dd40f7b9edf5e052d2f87c918e25d882616b48a69558dfb4f92761009edb
5
5
  SHA512:
6
- metadata.gz: '09973aaa310292cfdef323b4c66b2088db297b243b90e6149e7f6998165a9208adf74cbeb2665f0230ee6ac8dacc1632e1562eaff085bf07d6689ccfbcc0d75c'
7
- data.tar.gz: 38b8ba94d466720ff860a62a2542d1cb2ec106c88ffd000979203e8c9403e0aa42d0f4ba3e83e822270888a11b07f3b96296785c0fdc7b1b39fa12e019b07e6e
6
+ metadata.gz: af2eee6764e9c6de36c96cf1d830ddbb6c263f86e3a0e28bb79cb5a7e786c476fd100c8be38cc9226f6c7e6f9f8c4c0d5c73c039411096ddaddd160f72146b5f
7
+ data.tar.gz: 39c38cf9dbd66f4b7bb27447ebded7a54d999299ab5688bba51fbc6ac8a3ef5a4af29d0f0ec4c44461f300a19d7dde6d3bb5ca890453d42485758cc5740c9389
data/CHANGELOG.md CHANGED
@@ -1,10 +1,11 @@
1
- ### Version 1.0.5 (Apr 26, 2024)
1
+ ### Version 1.0.7 (Apr 27, 2024)
2
2
 
3
3
  * Support table indexes
4
4
  * Fix non-canonical UUID by [@PauloMiranda98](https://github.com/PauloMiranda98) in (#117)
5
5
  * Fix precision loss due to JSON float parsing by [@jenskdsgn](https://github.com/jenskdsgn) in (#129)
6
6
  * Support functions by [@felix-dumit](https://github.com/felix-dumit) in (#120)
7
7
  * Hotfix/rails71 change column by [@trumenov](https://github.com/trumenov) in (#132)
8
+ * Fix DB tasks
8
9
 
9
10
  ### Version 1.0.5 (Mar 14, 2024)
10
11
 
data/README.md CHANGED
@@ -202,7 +202,7 @@ false`. The default integer is `UInt32`
202
202
 
203
203
  Example:
204
204
 
205
- ``` ruby
205
+ ```ruby
206
206
  class CreateDataItems < ActiveRecord::Migration[7.1]
207
207
  def change
208
208
  create_table "data_items", id: false, options: "VersionedCollapsingMergeTree(sign, version) PARTITION BY toYYYYMM(day) ORDER BY category", force: :cascade do |t|
@@ -230,8 +230,8 @@ end
230
230
 
231
231
  Create table with custom column structure:
232
232
 
233
- ``` ruby
234
- class CreateDataItems < ActiveRecord::Migration
233
+ ```ruby
234
+ class CreateDataItems < ActiveRecord::Migration[7.1]
235
235
  def change
236
236
  create_table "data_items", id: false, options: "MergeTree PARTITION BY toYYYYMM(timestamp) ORDER BY timestamp", force: :cascade do |t|
237
237
  t.column "timestamp", "DateTime('UTC') CODEC(DoubleDelta, LZ4)"
@@ -240,6 +240,16 @@ class CreateDataItems < ActiveRecord::Migration
240
240
  end
241
241
  ```
242
242
 
243
+ Create Buffer table with connection database name:
244
+
245
+ ```ruby
246
+ class CreateDataItems < ActiveRecord::Migration[7.1]
247
+ def change
248
+ create_table :some_buffers, as: :some, options: "Buffer(#{connection.database}, some, 1, 10, 60, 100, 10000, 10000000, 100000000)"
249
+ end
250
+ end
251
+ ```
252
+
243
253
 
244
254
  ### Using replica and cluster params in connection parameters
245
255
 
@@ -88,6 +88,7 @@ module ActiveRecord
88
88
  create_sql = +"CREATE#{table_modifier_in_create(o)} #{o.view ? "VIEW" : "TABLE"} "
89
89
  create_sql << "IF NOT EXISTS " if o.if_not_exists
90
90
  create_sql << "#{quote_table_name(o.name)} "
91
+ add_as_clause!(create_sql, o) if o.as && !o.view
91
92
  add_to_clause!(create_sql, o) if o.materialized
92
93
 
93
94
  statements = o.columns.map { |c| accept c }
@@ -103,7 +104,7 @@ module ActiveRecord
103
104
  create_sql << "(#{statements.join(', ')})" if statements.present?
104
105
  # Attach options for only table or materialized view without TO section
105
106
  add_table_options!(create_sql, o) if !o.view || o.view && o.materialized && !o.to
106
- add_as_clause!(create_sql, o)
107
+ add_as_clause!(create_sql, o) if o.as && o.view
107
108
  create_sql
108
109
  end
109
110
 
@@ -293,7 +293,7 @@ module ActiveRecord
293
293
  options = apply_replica(table_name, options)
294
294
  td = create_table_definition(apply_cluster(table_name), **options)
295
295
  block.call td if block_given?
296
- td.column(:id, options[:id], null: false) if options[:id].present? && td[:id].blank?
296
+ td.column(:id, options[:id], null: false) if options[:id].present? && td[:id].blank? && options[:as].blank?
297
297
 
298
298
  if options[:force]
299
299
  drop_table(table_name, options.merge(if_exists: true))
@@ -431,6 +431,10 @@ module ActiveRecord
431
431
  @config[:replica_name]
432
432
  end
433
433
 
434
+ def database
435
+ @config[:database]
436
+ end
437
+
434
438
  def use_default_replicated_merge_tree_params?
435
439
  database_engine_atomic? && @config[:use_default_replicated_merge_tree_params]
436
440
  end
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '1.0.7'
2
+ VERSION = '1.0.8'
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: 1.0.7
4
+ version: 1.0.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: 2024-04-27 00:00:00.000000000 Z
11
+ date: 2024-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.3.7
157
+ rubygems_version: 3.5.9
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: ClickHouse ActiveRecord