annotato 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d46bed9c8d25cf14624fc0381d1742eead5efd0777705e8a55044ac797e0625a
4
- data.tar.gz: af4276aea78359e7feb0dff649b5a185fb6074e81cb287ee5dd724b329c2dbe1
3
+ metadata.gz: 11a779fb4ddeec8b6cf9f7858f821104466a9a769e58e137245636b9d62d459f
4
+ data.tar.gz: 2addea232a4a29643a66dd29396bf3d56614f2ff7923d516aba48e7b6b3f2379
5
5
  SHA512:
6
- metadata.gz: f430a13536edb3f88e2bfcb414c08c7fa38e369cd78b17957940ff7f0366a5b2da4846814e21a65c11b208cff1874850a53180634a142a885e2834b3f6a56fdc
7
- data.tar.gz: 7a8cca116a125eff5e994905bb2f2947a567a4146fe9f9a48b6116217d009eb3441ac5e3c109e008fb78c6db9fa439c63756cb5893bf642a4fa5c50ce837d0ac
6
+ metadata.gz: 7a04edef5bb90afad0d50ebb18c4590dc73e6ee8902f73d9a592291855d8f78c591c2174799d31d904d0fc1347df25baeedbe0383e57af156c9e59c16a2661c4
7
+ data.tar.gz: 8bf3fee198f5c60ed40b85b6d89ce6eecd3723171a51874338a8702a3b7436e1894db2a92dc8f62a08be534d782e35040d2fe74a36042836e13a5d9d597743bb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- annotato (0.2.3)
4
+ annotato (0.2.5)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
@@ -5,7 +5,7 @@ module Annotato
5
5
  extend WrapHelper
6
6
 
7
7
  def self.format(conn, table_name)
8
- conn.check_constraints(table_name).map do |chk|
8
+ conn.check_constraints(table_name).sort_by(&:name).map do |chk|
9
9
  expr_clause = ""
10
10
  if chk.expression
11
11
  expr_clause = "\n" + wrap_sql(chk.expression, first_prefix: "# (", cont_prefix: "# ")
@@ -8,19 +8,18 @@ module Annotato
8
8
  class EnumFormatter
9
9
  def self.format(conn, columns)
10
10
  # Collect columns backed by a native PG enum type.
11
- # A native enum type is one that exists in pg_type with typtype = 'e'.
12
11
  enum_columns = columns.select { |col| pg_enum_type?(conn, col.sql_type) }
13
12
  return [] if enum_columns.empty?
14
13
 
15
- enum_columns.map do |col|
14
+ enum_columns.flat_map do |col|
16
15
  labels = pg_enum_labels(conn, col.sql_type)
17
16
  lines = ["# #{col.name} (#{col.sql_type}): ["]
18
- lines += labels.map.with_index { |label, i|
17
+ labels.each_with_index do |label, i|
19
18
  comma = i == labels.size - 1 ? "" : ","
20
- "# #{label}#{comma}"
21
- }
19
+ lines << "# #{label}#{comma}"
20
+ end
22
21
  lines << "# ]"
23
- lines.join("\n")
22
+ lines
24
23
  end
25
24
  end
26
25
 
@@ -40,7 +39,7 @@ module Annotato
40
39
  conn.exec_query(
41
40
  "SELECT e.enumlabel FROM pg_enum e " \
42
41
  "JOIN pg_type t ON e.enumtypid = t.oid " \
43
- "WHERE t.typname = $1 " \
42
+ "WHERE t.typname = $1 AND t.typtype = 'e' " \
44
43
  "ORDER BY e.enumsortorder",
45
44
  "SQL",
46
45
  [type_name]
@@ -5,7 +5,7 @@ module Annotato
5
5
  extend WrapHelper
6
6
 
7
7
  def self.format(conn, table_name)
8
- conn.indexes(table_name).map do |idx|
8
+ conn.indexes(table_name).sort_by(&:name).map do |idx|
9
9
  cols_list = Array(idx.columns).join(',')
10
10
  unique_clause = idx.unique ? " unique" : ""
11
11
 
@@ -24,7 +24,7 @@ module Annotato
24
24
  return []
25
25
  end
26
26
 
27
- rows.map { |r| "# #{r['name']}" }
27
+ rows.map { |r| "# #{r['name']}" }.sort
28
28
  end
29
29
  end
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Annotato
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.5"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annotato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhii Bodnaruk
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-06-30 00:00:00.000000000 Z
10
+ date: 2026-07-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails