Skip to content

Commit 9391d8c

Browse files
committed
fix insert with default values in Ruby 4.0 and Rails 8.1
1 parent 48c74a6 commit 9391d8c

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 1.6.7 (Mar 5, 2026)
2+
3+
* Fix insert with default values in Ruby 4.0 and Rails 8.1
4+
15
### Version 1.6.6 (Feb 16, 2026)
26

37
* Fix error: EOFError (end of file reached)

lib/active_record/connection_adapters/clickhouse/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def execute_to_file(sql, name = nil, format: @response_format, settings: {})
7878
def exec_insert(sql, name = nil, _binds = [], _pk = nil, _sequence_name = nil, returning: nil)
7979
new_sql = sql.sub(/ (DEFAULT )?VALUES/, " VALUES")
8080
with_response_format(nil) { execute(new_sql, name) }
81-
true
81+
nil
8282
end
8383

8484
def internal_exec_query(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false)

lib/clickhouse-activerecord/rspec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
original_connection_config = ActiveRecord::Base.connection_db_config
66
ActiveRecord::Base.configurations.configurations.select { |x| x.env_name == Rails.env && x.adapter == 'clickhouse' }.each do |db_config|
77
ActiveRecord::Base.establish_connection(db_config)
8-
ActiveRecord::Base.connection.truncate_tables(*ActiveRecord::Base.connection.tables)
8+
ActiveRecord::Base.connection.execute("TRUNCATE ALL TABLES FROM #{db_config.database}")
99
end
1010
ActiveRecord::Base.establish_connection(original_connection_config)
1111
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ClickhouseActiverecord
2-
VERSION = '1.6.6'
2+
VERSION = '1.6.7'
33
end

spec/fixtures/migrations/add_sample_data/1_create_sample_table.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def up
1212
t.string :byte_array
1313
t.uuid :relation_uuid
1414
t.decimal :decimal_value, precision: 38, scale: 16
15+
t.datetime :ver, precision: 3, default: -> { 'now64()' }, null: false
1516
end
1617
end
1718
end

0 commit comments

Comments
 (0)