diff --git a/lib/clickhouse-activerecord/schema_dumper.rb b/lib/clickhouse-activerecord/schema_dumper.rb index 1de8286..f727d84 100644 --- a/lib/clickhouse-activerecord/schema_dumper.rb +++ b/lib/clickhouse-activerecord/schema_dumper.rb @@ -111,8 +111,11 @@ def table(table, stream) def function(function, stream) stream.puts " # FUNCTION: #{function}" sql = @connection.show_create_function(function) - stream.puts " # SQL: #{sql}" if sql - stream.puts " create_function \"#{function}\", \"#{sql.gsub(/^CREATE FUNCTION (.*?) AS/, '').strip}\", force: true" if sql + if sql + stream.puts " # SQL: #{sql}" + stream.puts " create_function \"#{function}\", \"#{sql.gsub(/^CREATE FUNCTION (.*?) AS/, '').strip}\", force: true" + stream.puts + end end def format_options(options)