annotaterb 4.9.0 → 4.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09caaf3fa0cb79967a6273386ea6e181e6f22c614ea2e43da32b67abe877cf95'
4
- data.tar.gz: a0181d18310997f66cfb79f3e0d3fdb030708ff55c7492f2821d9024126c3f55
3
+ metadata.gz: ab40ea1034e6f377865be3de919a8df7f32cd6b655def53590b4061389ce518a
4
+ data.tar.gz: 1cc47f8f90e22930b7267727de068bacda45f0596df6bd15459c9d935e86f1f0
5
5
  SHA512:
6
- metadata.gz: 5be5ad218586f3a24854edc995ddaf3334507a46c54bfa28325e71706a502a2ce1ca5b8aa53822cf40d51724f16cb9086ea480e61aba7954e916c270484763d5
7
- data.tar.gz: 9ab288486df138231ad168161238e08442b9b80e7b6f06adc21266d0ce002116bf7035313213e6a2db7df743e5f731e0ef2b18df43993837aa4debbf0f9137fd
6
+ metadata.gz: fed4abbcf53babf0b3854eacfb85078eb36716e2ddaaefa112e174c28f8a9694137f4fbe5b3e4ac73fc30f7b9786308a6770f62e692e101c676fee7ff3af6801
7
+ data.tar.gz: b41107dd5b24a83f3c50e890eb24491665aa07253be3bf6e79caec4ab1ee898888ef84192ba691064a158cc4672ccfb7db18416970f61ce0add026a81e9116b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.9.0](https://github.com/drwl/annotaterb/tree/v4.9.0) (2024-05-29)
4
+
5
+ [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.8.0...v4.9.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Duplicate content in fixtures when annotating models [\#108](https://github.com/drwl/annotaterb/issues/108)
10
+ - Cannot exclude annotations from serializer specs [\#103](https://github.com/drwl/annotaterb/issues/103)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Bump version to v4.9.0 [\#119](https://github.com/drwl/annotaterb/pull/119) ([drwl](https://github.com/drwl))
15
+ - Add support for `NOT VALID` constraints [\#118](https://github.com/drwl/annotaterb/pull/118) ([gmcabrita](https://github.com/gmcabrita))
16
+ - Generate changelog for v4.8.0 [\#116](https://github.com/drwl/annotaterb/pull/116) ([drwl](https://github.com/drwl))
17
+
3
18
  ## [v4.8.0](https://github.com/drwl/annotaterb/tree/v4.8.0) (2024-05-14)
4
19
 
5
20
  [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.7.1...v4.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.9.0
1
+ 4.10.0
@@ -23,14 +23,19 @@ module AnnotateRb
23
23
  return "" if foreign_keys.empty?
24
24
 
25
25
  format_name = lambda do |fk|
26
- return fk.options[:column] if fk.name.blank?
26
+ return fk.column if fk.name.blank?
27
27
 
28
28
  @options[:show_complete_foreign_keys] ? fk.name : fk.name.gsub(/(?<=^fk_rails_)[0-9a-f]{10}$/, "...")
29
29
  end
30
30
 
31
31
  max_size = foreign_keys.map(&format_name).map(&:size).max + 1
32
- foreign_keys.sort_by { |fk| [format_name.call(fk), fk.column] }.each do |fk|
33
- ref_info = "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
32
+ foreign_keys.sort_by { |fk| [format_name.call(fk), stringify_columns(fk.column)] }.each do |fk|
33
+ ref_info = if fk.column.is_a?(Array) # Composite foreign key using multiple columns
34
+ "#{stringify_columns(fk.column)} => #{fk.to_table}#{stringify_columns(fk.primary_key)}"
35
+ else
36
+ "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
37
+ end
38
+
34
39
  constraints_info = ""
35
40
  constraints_info += "ON DELETE => #{fk.on_delete} " if fk.on_delete
36
41
  constraints_info += "ON UPDATE => #{fk.on_update} " if fk.on_update
@@ -51,6 +56,13 @@ module AnnotateRb
51
56
 
52
57
  fk_info
53
58
  end
59
+
60
+ private
61
+
62
+ # The fk columns might be composite keys, so format them into a string for the annotation
63
+ def stringify_columns(columns)
64
+ columns.is_a?(Array) ? "[#{columns.join(", ")}]" : columns
65
+ end
54
66
  end
55
67
  end
56
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annotaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew W. Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Annotates Rails/ActiveRecord Models, routes, fixtures, and others based
14
14
  on the database schema.