sequel-annotate 1.3.0 → 1.3.1

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: 024d60493f6cff6f11e88759519c7bea3527e085d0bd888f8cc84ed74dba112c
4
- data.tar.gz: 722da23fe55ebe66b84377ff62ac851d20417950173bb977f21bd7678710f279
3
+ metadata.gz: 6bc04d174477ed481ef99f6d4173ed4ad691f55d4283c42cb971b8a32772bb41
4
+ data.tar.gz: d8bfaa715162f40446c079e91dfa32555e18200578dce2f1ad218580157c8ca3
5
5
  SHA512:
6
- metadata.gz: 1340b7bc98e1650fc91075a5cdd34d4e5f56c21a6c58b8b9c460b68d0bb8fb0997b82f7294d04d9f90b377b2b236057901f711c16a0233ff951948f1f48f39da
7
- data.tar.gz: e64ebdcbe577333c76b94fbd45ea795eb918193e46493dd8dba76789214250faba6ab97b5c765d4143be68ecf28d7f29cc7bc76b52750b0ad1ff96e445b4a211
6
+ metadata.gz: c45070f85dd3dd1acf89946a18463dd7f2245adb2881888b145c93b54dec5b294235adc603a1033ddb6ba2a611d198694d152950f8626a8f101a846c1977e8d8
7
+ data.tar.gz: 574cee166afd77a7a9353fbeb3ebd4bbbaf2afeb4055265f0371c67218676596594ee316758e4cda2641f7da51a923d271ecfab64c429baf65f583a2ac3301cc
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.3.1 (2018-09-27)
2
+
3
+ * Make sure all annotation lines are commented by handling newlines inside annotations (jeremyevans)
4
+
1
5
  === 1.3.0 (2018-07-17)
2
6
 
3
7
  * Support :namespace option to specify namespace to add for models nested in namespaces (jeremyevans)
@@ -101,7 +101,7 @@ module Sequel
101
101
  end
102
102
 
103
103
  rows.map do |r|
104
- "# #{r.zip(lengths).map{|c, l| c.ljust(l)}.join(' | ')}".strip
104
+ "# #{r.zip(lengths).map{|c, l| c.ljust(l).gsub("\n", "\n# ")}.join(' | ')}".strip
105
105
  end
106
106
  end
107
107
 
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  DB.drop_function(:valid_price) rescue nil
18
18
  [DB, SDB].each do |db|
19
- db.drop_table?(:items, :manufacturers, :categories)
19
+ db.drop_table?(:newline_tests, :items, :manufacturers, :categories)
20
20
 
21
21
  db.create_table :categories do
22
22
  primary_key :id
@@ -45,6 +45,12 @@ DB.drop_function(:valid_price) rescue nil
45
45
  index [:manufacturer_name, :manufacturer_location], :name=>:name, :unique=>true
46
46
  index [:manufacturer_name], :name=>:manufacturer_name
47
47
  end
48
+
49
+ db.create_table :newline_tests do
50
+ Integer :abcde_fghi_id
51
+ Integer :jkl_mnopqr_id
52
+ constraint(:valid_stuvw_xyz0, Sequel.case({{:abcde_fghi_id=>[5,6]}=>Sequel.~(:jkl_mnopqr_id=>nil)}, :jkl_mnopqr_id=>nil))
53
+ end
48
54
  end
49
55
 
50
56
  DB.run <<SQL
@@ -75,6 +81,7 @@ class ::Manufacturer < Sequel::Model; end
75
81
  class ::SItem < Sequel::Model(SDB[:items]); end
76
82
  class ::SCategory < Sequel::Model(SDB[:categories]); end
77
83
  class ::SManufacturer < Sequel::Model(SDB[:manufacturers]); end
84
+ class ::NewlineTest < Sequel::Model; end
78
85
 
79
86
  # Abstract Base Class
80
87
  ABC = Class.new(Sequel::Model)
@@ -146,6 +153,19 @@ OUTPUT
146
153
  # manufacturers_pkey | PRIMARY KEY btree (name, location)
147
154
  # Referenced By:
148
155
  # items | items_manufacturer_name_fkey | (manufacturer_name, manufacturer_location) REFERENCES manufacturers(name, location)
156
+ OUTPUT
157
+
158
+ Sequel::Annotate.new(NewlineTest).schema_comment.must_equal((<<OUTPUT).chomp)
159
+ # Table: newline_tests
160
+ # Columns:
161
+ # abcde_fghi_id | integer |
162
+ # jkl_mnopqr_id | integer |
163
+ # Check constraints:
164
+ # valid_stuvw_xyz0 | (
165
+ # CASE
166
+ # WHEN abcde_fghi_id = ANY (ARRAY[5, 6]) THEN jkl_mnopqr_id IS NOT NULL
167
+ # ELSE jkl_mnopqr_id IS NULL
168
+ # END)
149
169
  OUTPUT
150
170
 
151
171
  Sequel::Annotate.new(SItem).schema_comment.must_equal((<<OUTPUT).chomp)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-annotate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-17 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel