Skip to content

Commit

Permalink
Hotfix/rails71 change column (#132)
Browse files Browse the repository at this point in the history
fixed migration attrs for change_column
  • Loading branch information
trumenov authored Apr 22, 2024
1 parent 6ad665c commit 4495c4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions lib/active_record/connection_adapters/clickhouse_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4495c4c

Please sign in to comment.