From ddfa259bbec88aefa3eaf2942392b8473a477601 Mon Sep 17 00:00:00 2001 From: nixx Date: Fri, 27 Sep 2024 13:54:22 +0300 Subject: [PATCH] fix schema dumper --- CHANGELOG.md | 12 ++++++++++++ lib/clickhouse-activerecord/schema_dumper.rb | 13 ++++--------- lib/clickhouse-activerecord/version.rb | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cdd42c5..07c1d293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/clickhouse-activerecord/schema_dumper.rb b/lib/clickhouse-activerecord/schema_dumper.rb index 4c74c744..44a2bd8c 100644 --- a/lib/clickhouse-activerecord/schema_dumper.rb +++ b/lib/clickhouse-activerecord/schema_dumper.rb @@ -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 diff --git a/lib/clickhouse-activerecord/version.rb b/lib/clickhouse-activerecord/version.rb index 7c06c7de..00f5c2e5 100644 --- a/lib/clickhouse-activerecord/version.rb +++ b/lib/clickhouse-activerecord/version.rb @@ -1,3 +1,3 @@ module ClickhouseActiverecord - VERSION = '1.1.2' + VERSION = '1.1.3' end