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 +4 -4
- data/CHANGELOG +4 -0
- data/lib/sequel/annotate.rb +1 -1
- data/spec/sequel-annotate_spec.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bc04d174477ed481ef99f6d4173ed4ad691f55d4283c42cb971b8a32772bb41
|
4
|
+
data.tar.gz: d8bfaa715162f40446c079e91dfa32555e18200578dce2f1ad218580157c8ca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45070f85dd3dd1acf89946a18463dd7f2245adb2881888b145c93b54dec5b294235adc603a1033ddb6ba2a611d198694d152950f8626a8f101a846c1977e8d8
|
7
|
+
data.tar.gz: 574cee166afd77a7a9353fbeb3ebd4bbbaf2afeb4055265f0371c67218676596594ee316758e4cda2641f7da51a923d271ecfab64c429baf65f583a2ac3301cc
|
data/CHANGELOG
CHANGED
data/lib/sequel/annotate.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|