Skip to content

Commit 69dbcfa

Browse files
woodhullclaude
andcommitted
Merge upstream/master while preserving fork functionality
This merge brings in the latest improvements from upstream including: - JSON column type support (PNixx#209) - Fixed regex to match FROM keyword (PNixx#220) - Active Record 8.1 support - SQL structure dumper improvements - Better format logic encapsulation (PNixx#162) - Schema dumper fixes (PNixx#206) - Unscope :final and :settings (PNixx#208) Fork-specific functionality preserved: - EOFError and Errno::ECONNRESET retry logic (integrated into raw_execute) - Custom insert settings via ClickhouseActiverecord::Settings thread-local - disconnect! method implementation - Security fix: no hardcoded OpenSSL::SSL::VERIFY_NONE - Async insert configuration support The retry logic has been adapted to work with the new execute/raw_execute architecture introduced by upstream, ensuring compatibility with the refactored code structure while maintaining reliability for connection errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 parents ebeccf3 + 2b19fd7 commit 69dbcfa

File tree

29 files changed

+833
-286
lines changed

29 files changed

+833
-286
lines changed

.docker/clickhouse/cluster/server1_config.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
1616
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
1717
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
18+
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>
1819
<keep_alive_timeout>3</keep_alive_timeout>
1920

2021
<logger>
21-
<level>debug</level>
22+
<level>error</level>
2223
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
2324
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
2425
<size>1000M</size>
2526
<count>10</count>
26-
<console>1</console>
27+
<console>0</console>
2728
</logger>
2829

2930
<remote_servers>
@@ -114,4 +115,11 @@
114115
<value>86400</value>
115116
</header>
116117
</http_options_response>
118+
119+
<user_directories>
120+
<users_xml>
121+
<path>users.xml</path>
122+
</users_xml>
123+
</user_directories>
124+
117125
</clickhouse>

.docker/clickhouse/cluster/server2_config.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
1616
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
1717
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
18+
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>
1819
<keep_alive_timeout>3</keep_alive_timeout>
1920

2021
<logger>
21-
<level>debug</level>
22+
<level>error</level>
2223
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
2324
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
2425
<size>1000M</size>
2526
<count>10</count>
26-
<console>1</console>
27+
<console>0</console>
2728
</logger>
2829

2930
<remote_servers>
@@ -114,4 +115,11 @@
114115
<value>86400</value>
115116
</header>
116117
</http_options_response>
118+
119+
<user_directories>
120+
<users_xml>
121+
<path>users.xml</path>
122+
</users_xml>
123+
</user_directories>
124+
117125
</clickhouse>

.docker/clickhouse/single/config.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
1515
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
1616
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
17+
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>
1718
<keep_alive_timeout>3</keep_alive_timeout>
1819

1920
<logger>
20-
<level>debug</level>
21+
<level>error</level>
2122
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
2223
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
2324
<size>1000M</size>
2425
<count>10</count>
25-
<console>1</console>
26+
<console>0</console>
2627
</logger>
2728

2829
<query_log>
@@ -51,4 +52,10 @@
5152
</header>
5253
</http_options_response>
5354

55+
<user_directories>
56+
<users_xml>
57+
<path>users.xml</path>
58+
</users_xml>
59+
</user_directories>
60+
5461
</clickhouse>

.docker/clickhouse/users.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@
88
</profiles>
99

1010
<users>
11+
<test>
12+
<password>test</password>
13+
<networks>
14+
<ip>::/0</ip>
15+
</networks>
16+
<profile>default</profile>
17+
<quota>default</quota>
18+
<access_management>1</access_management>
19+
</test>
1120
<default>
12-
<password></password>
21+
<password />
1322
<networks>
1423
<ip>::/0</ip>
1524
</networks>

.docker/docker-compose.cluster.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
clickhouse1:
3-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
3+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}'
44
ulimits:
55
nofile:
66
soft: 262144
@@ -18,7 +18,7 @@ services:
1818
interval: 5s
1919

2020
clickhouse2:
21-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
21+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}'
2222
ulimits:
2323
nofile:
2424
soft: 262144

.docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
clickhouse:
3-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
3+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}'
44
container_name: 'clickhouse-activerecord-clickhouse-server'
55
ports:
66
- '18123:8123'

.github/workflows/testing.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
env:
1515
CLICKHOUSE_PORT: 18123
1616
CLICKHOUSE_DATABASE: default
17+
CLICKHOUSE_USER: test
18+
CLICKHOUSE_PASSWORD: test
1719

1820
strategy:
1921
fail-fast: true
@@ -22,21 +24,21 @@ jobs:
2224
version:
2325
- ruby: 2.7
2426
rails: 7.1.3
25-
- ruby: 3.0
26-
rails: 7.1.3
2727
- ruby: 3.2
2828
rails: 7.1.3
2929
- ruby: 3.2
3030
rails: 7.2.1
3131
- ruby: 3.2
3232
rails: 8.0.1
33-
clickhouse: [ '22.1', '24.9' ]
33+
- ruby: 3.2
34+
rails: 8.1
35+
clickhouse: [ '24.9', '25.10' ]
3436

3537
steps:
3638
- uses: actions/checkout@v4
3739

3840
- name: Start ClickHouse ${{ matrix.clickhouse }}
39-
uses: hoverkraft-tech/compose-action@v2.1.0
41+
uses: hoverkraft-tech/compose-action@v2.4.1
4042
env:
4143
CLICKHOUSE_VERSION: ${{ matrix.clickhouse }}
4244
with:
@@ -61,6 +63,8 @@ jobs:
6163
CLICKHOUSE_PORT: 28123
6264
CLICKHOUSE_DATABASE: default
6365
CLICKHOUSE_CLUSTER: test_cluster
66+
CLICKHOUSE_USER: test
67+
CLICKHOUSE_PASSWORD: test
6468

6569
strategy:
6670
fail-fast: true
@@ -69,21 +73,21 @@ jobs:
6973
version:
7074
- ruby: 2.7
7175
rails: 7.1.3
72-
- ruby: 3.0
73-
rails: 7.1.3
7476
- ruby: 3.2
7577
rails: 7.1.3
7678
- ruby: 3.2
7779
rails: 7.2.1
7880
- ruby: 3.2
7981
rails: 8.0.1
80-
clickhouse: [ '22.1', '24.9' ]
82+
- ruby: 3.2
83+
rails: 8.1
84+
clickhouse: [ '24.9', '25.10' ]
8185

8286
steps:
8387
- uses: actions/checkout@v4
8488

8589
- name: Start ClickHouse Cluster ${{ matrix.clickhouse }}
86-
uses: hoverkraft-tech/compose-action@v2.1.0
90+
uses: hoverkraft-tech/compose-action@v2.4.1
8791
env:
8892
CLICKHOUSE_VERSION: ${{ matrix.clickhouse }}
8993
with:

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
### Version 1.5.1 (Nov 6, 2025)
2+
3+
* Fix rake tasks
4+
5+
### Version 1.5.0 (Nov 5, 2025)
6+
7+
* 🎉 Support for Rails 8.1
8+
* Fix sql structure dump with `schema_migrations` #138
9+
* Remove old tasks
10+
11+
### Version 1.4.0 (Sep 18, 2025)
12+
13+
* `CREATE OR REPLACE FUNCTION` in SQL schema dumps in #198
14+
* Added shard config to handle replica path with shard in #201
15+
* Add support for simple schema dumping in #203
16+
* Unscope :final and :settings in #208
17+
* Encapsulate format logic within Statement and helper classes in #162
18+
119
### Version 1.3.1 (Feb 12, 2025)
220

321
* Restore replace database from dump schema table creation

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ Engines `MergeTree` and all support replication engines will be replaced to `Rep
285285

286286
Donations to this project are going directly to [PNixx](https://github.com/PNixx), the original author of this project:
287287

288-
* BTC address: `1H3rhpf7WEF5JmMZ3PVFMQc7Hm29THgUfN`
288+
* BTC address: `bc1qr73vls0kv2ujk4ugqmpqj6j0qtqvdr3nx25xdl`
289289
* ETH address: `0x6F094365A70fe7836A633d2eE80A1FA9758234d5`
290290
* XMR address: `42gP71qLB5M43RuDnrQ3vSJFFxis9Kw9VMURhpx9NLQRRwNvaZRjm2TFojAMC8Fk1BQhZNKyWhoyJSn5Ak9kppgZPjE17Zh`
291-
* TON address: `UQBt0-s1igIpJoEup0B1yAUkZ56rzbpruuAjNhQ26MVCaNlC`
291+
* TON address: `UQBCnxOfBsHPZ3PesGgMedVMEf5UHnm0jrSq-042pMWw08Ux`
292292

293293
## Development
294294

lib/active_record/connection_adapters/clickhouse/column.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Column < ActiveRecord::ConnectionAdapters::Column
55

66
attr_reader :codec
77

8-
def initialize(name, default, sql_type_metadata = nil, null = true, default_function = nil, codec: nil, **args)
8+
def initialize(*, codec: nil, **)
99
super
1010
@codec = codec
1111
end

0 commit comments

Comments
 (0)