From 170dbcff304ec842e9b2465bf6e317a1bd0343e7 Mon Sep 17 00:00:00 2001 From: trumenov Date: Mon, 22 Apr 2024 17:37:53 +0300 Subject: [PATCH 1/3] #rails71_change_column fixed --- lib/active_record/connection_adapters/clickhouse_adapter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/active_record/connection_adapters/clickhouse_adapter.rb b/lib/active_record/connection_adapters/clickhouse_adapter.rb index d89cd2ca..71abfeb1 100644 --- a/lib/active_record/connection_adapters/clickhouse_adapter.rb +++ b/lib/active_record/connection_adapters/clickhouse_adapter.rb @@ -441,9 +441,9 @@ def last_inserted_id(result) result end - def change_column_for_alter(table_name, column_name, type, options = {}) + def change_column_for_alter(table_name, column_name, type, **options) td = create_table_definition(table_name) - cd = td.new_column_definition(column_name, type, options) + cd = td.new_column_definition(column_name, type, **options) schema_creation.accept(ChangeColumnDefinition.new(cd, column_name)) end From 38d0ce9d8a8dee8a61616487efe4a720cc05f3f7 Mon Sep 17 00:00:00 2001 From: trumenov Date: Mon, 22 Apr 2024 17:45:24 +0300 Subject: [PATCH 2/3] #rails71_change_column fixed2 --- lib/active_record/connection_adapters/clickhouse_adapter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/active_record/connection_adapters/clickhouse_adapter.rb b/lib/active_record/connection_adapters/clickhouse_adapter.rb index 71abfeb1..2eaa6e74 100644 --- a/lib/active_record/connection_adapters/clickhouse_adapter.rb +++ b/lib/active_record/connection_adapters/clickhouse_adapter.rb @@ -371,8 +371,8 @@ def remove_column(table_name, column_name, type = nil, **options) execute("ALTER TABLE #{quote_table_name(table_name)} #{remove_column_for_alter(table_name, column_name, type, **options)}", nil, settings: {wait_end_of_query: 1, send_progress_in_http_headers: 1}) end - def change_column(table_name, column_name, type, options = {}) - result = do_execute("ALTER TABLE #{quote_table_name(table_name)} #{change_column_for_alter(table_name, column_name, type, options)}", nil, settings: {wait_end_of_query: 1, send_progress_in_http_headers: 1}) + def change_column(table_name, column_name, type, **options) + result = do_execute("ALTER TABLE #{quote_table_name(table_name)} #{change_column_for_alter(table_name, column_name, type, **options)}", nil, settings: {wait_end_of_query: 1, send_progress_in_http_headers: 1}) raise "Error parse json response: #{result}" if result.presence && !result.is_a?(Hash) end From fa96df17bf10e93569374391b864708024b038b3 Mon Sep 17 00:00:00 2001 From: trumenov Date: Mon, 22 Apr 2024 17:52:12 +0300 Subject: [PATCH 3/3] #rails71_change_column fix3 --- .../connection_adapters/clickhouse/schema_creation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_record/connection_adapters/clickhouse/schema_creation.rb b/lib/active_record/connection_adapters/clickhouse/schema_creation.rb index aa20d7c9..64aeb556 100644 --- a/lib/active_record/connection_adapters/clickhouse/schema_creation.rb +++ b/lib/active_record/connection_adapters/clickhouse/schema_creation.rb @@ -108,7 +108,7 @@ def table_modifier_in_create(o) def visit_ChangeColumnDefinition(o) column = o.column - column.sql_type = type_to_sql(column.type, column.options) + column.sql_type = type_to_sql(column.type, **column.options) options = column_options(column) quoted_column_name = quote_column_name(o.name)