Skip to content

Commit

Permalink
Quote table names with periods (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbeland authored Jul 11, 2024
1 parent 65ef7e3 commit 29d0079
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/clickhouse-activerecord/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def table(table, stream)
raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
next if column.name == pk
type, colspec = column_spec(column)
tbl.print " t.#{type} #{column.name.inspect}"
name = column.name =~ (/\./) ? "\"`#{column.name}`\"" : column.name.inspect
tbl.print " t.#{type} #{name}"
tbl.print ", #{format_colspec(colspec)}" if colspec.present?
tbl.puts
end
Expand Down

0 comments on commit 29d0079

Please sign in to comment.