Skip to content

Commit

Permalink
fix schema dumper for buffer table
Browse files Browse the repository at this point in the history
  • Loading branch information
PNixx committed May 3, 2024
1 parent 34684cf commit 1d9f544
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/clickhouse-activerecord/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def table(table, stream)
unless simple
table_options = @connection.table_options(table)
if table_options.present?
tbl.print ", #{format_options(table_options)}"
table_options = format_options(table_options)
table_options.gsub!(/Buffer\('[^']+'/, 'Buffer(\'#{connection.database}\'')
tbl.print ", #{table_options}"
end
end

Expand Down Expand Up @@ -138,7 +140,7 @@ def function(function, stream)

def format_options(options)
if options && options[:options]
options[:options] = options[:options].gsub(/^Replicated(.*?)\('[^']+',\s*'[^']+',?\s?([^\)]*)?\)/, "\\1(\\2)")
options[:options].gsub!(/^Replicated(.*?)\('[^']+',\s*'[^']+',?\s?([^\)]*)?\)/, "\\1(\\2)")
end
super
end
Expand Down
2 changes: 1 addition & 1 deletion lib/clickhouse-activerecord/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ClickhouseActiverecord
VERSION = '1.0.8'
VERSION = '1.0.9'
end

0 comments on commit 1d9f544

Please sign in to comment.