Skip to content

Commit

Permalink
fix schema dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
PNixx committed Sep 27, 2024
1 parent 246775c commit ddfa259
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### Version 1.1.2 (Aug 27, 2024)
* 🎉 Support for rails 7.2 #156
* Add method `views` for getting table `View` list in #152
* Add support for Map datatype in #144
* Add support window named functions
* Fix schema dumper default values for number
* Normalize table name in schema dump in #148
* Noop savepoint functionality in #150
* Fix `#find_by` in #153
* Add RSpec configure
* Fix detect model primary key

### Version 1.0.7 (Apr 27, 2024)

* Support table indexes
Expand Down
13 changes: 4 additions & 9 deletions lib/clickhouse-activerecord/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,11 @@ def table(table, stream)
tbl.print ', materialized: true' if match && match[1].presence
end

case pk
when String
tbl.print ", primary_key: #{pk.inspect}" unless pk == "id"
pkcol = columns.detect { |c| c.name == pk }
pkcolspec = column_spec_for_primary_key(pkcol)
if pkcolspec.present?
tbl.print ", #{format_colspec(pkcolspec)}"
if (id = columns.detect { |c| c.name == 'id' })
spec = column_spec_for_primary_key(id)
if spec.present?
tbl.print ", #{format_colspec(spec)}"
end
when Array
tbl.print ", primary_key: #{pk.inspect}"
else
tbl.print ", id: false"
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.1.2'
VERSION = '1.1.3'
end

0 comments on commit ddfa259

Please sign in to comment.