dbee 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +11 -0
- data/README.md +133 -58
- data/dbee.gemspec +5 -2
- data/lib/dbee.rb +9 -10
- data/lib/dbee/base.rb +7 -49
- data/lib/dbee/dsl_schema_builder.rb +86 -0
- data/lib/dbee/key_chain.rb +11 -0
- data/lib/dbee/model.rb +50 -38
- data/lib/dbee/model/relationships.rb +24 -0
- data/lib/dbee/model/relationships/basic.rb +47 -0
- data/lib/dbee/query.rb +4 -0
- data/lib/dbee/query/field.rb +1 -6
- data/lib/dbee/schema.rb +66 -0
- data/lib/dbee/schema_creator.rb +107 -0
- data/lib/dbee/schema_from_tree_based_model.rb +47 -0
- data/lib/dbee/util/make_keyed_by.rb +50 -0
- data/lib/dbee/version.rb +1 -1
- data/spec/dbee/base_spec.rb +9 -72
- data/spec/dbee/constant_resolver_spec.rb +17 -12
- data/spec/dbee/dsl_schema_builder_spec.rb +106 -0
- data/spec/dbee/key_chain_spec.rb +24 -0
- data/spec/dbee/model/constraints_spec.rb +6 -7
- data/spec/dbee/model_spec.rb +62 -59
- data/spec/dbee/query/filters_spec.rb +16 -17
- data/spec/dbee/query_spec.rb +55 -54
- data/spec/dbee/schema_creator_spec.rb +163 -0
- data/spec/dbee/schema_from_tree_based_model_spec.rb +31 -0
- data/spec/dbee/schema_spec.rb +62 -0
- data/spec/dbee_spec.rb +17 -37
- data/spec/fixtures/models.yaml +254 -56
- data/spec/spec_helper.rb +7 -0
- metadata +66 -9
data/spec/fixtures/models.yaml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Theaters, Members, and Movies:
|
1
|
+
Theaters, Members, and Movies Tree Based:
|
2
2
|
name: theater
|
3
3
|
table: theaters
|
4
4
|
models:
|
@@ -119,7 +119,217 @@ Theaters, Members, and Movies:
|
|
119
119
|
- type: static
|
120
120
|
name: genre
|
121
121
|
value: comedy
|
122
|
+
|
123
|
+
# Note that since converting from the tree does not have as much context as
|
124
|
+
# converting from the DSL, the resulting graph is a bit different.
|
125
|
+
Theaters, Members, and Movies from Tree:
|
126
|
+
theater:
|
127
|
+
table: theaters
|
128
|
+
relationships:
|
129
|
+
members:
|
130
|
+
constraints:
|
131
|
+
- type: reference
|
132
|
+
parent: id
|
133
|
+
name: tid
|
134
|
+
- type: reference
|
135
|
+
parent: partition
|
136
|
+
name: partition
|
137
|
+
parent_theater:
|
138
|
+
constraints:
|
139
|
+
- type: reference
|
140
|
+
name: id
|
141
|
+
parent: parent_theater_id
|
142
|
+
members:
|
143
|
+
relationships:
|
144
|
+
demos:
|
145
|
+
constraints:
|
146
|
+
- type: reference
|
147
|
+
parent: id
|
148
|
+
name: member_id
|
149
|
+
movies:
|
150
|
+
constraints:
|
151
|
+
- type: reference
|
152
|
+
parent: id
|
153
|
+
name: member_id
|
154
|
+
favorite_comic_movies:
|
155
|
+
constraints:
|
156
|
+
- type: reference
|
157
|
+
parent: id
|
158
|
+
name: member_id
|
159
|
+
- type: static
|
160
|
+
name: genre
|
161
|
+
value: comic
|
162
|
+
favorite_mystery_movies:
|
163
|
+
constraints:
|
164
|
+
- type: reference
|
165
|
+
parent: id
|
166
|
+
name: member_id
|
167
|
+
- type: static
|
168
|
+
name: genre
|
169
|
+
value: mystery
|
170
|
+
favorite_comedy_movies:
|
171
|
+
constraints:
|
172
|
+
- type: reference
|
173
|
+
parent: id
|
174
|
+
name: member_id
|
175
|
+
- type: static
|
176
|
+
name: genre
|
177
|
+
value: comedy
|
178
|
+
demos:
|
179
|
+
table: demographics
|
180
|
+
relationships:
|
181
|
+
phone_numbers:
|
182
|
+
constraints:
|
183
|
+
- type: reference
|
184
|
+
parent: id
|
185
|
+
name: demographic_id
|
186
|
+
phone_numbers:
|
187
|
+
movies:
|
188
|
+
favorite_comic_movies:
|
189
|
+
table: movies
|
190
|
+
favorite_mystery_movies:
|
191
|
+
table: movies
|
192
|
+
favorite_comedy_movies:
|
193
|
+
table: movies
|
194
|
+
parent_theater:
|
195
|
+
table: theaters
|
196
|
+
relationships:
|
197
|
+
members:
|
198
|
+
constraints:
|
199
|
+
- type: reference
|
200
|
+
parent: id
|
201
|
+
name: tid
|
202
|
+
- type: reference
|
203
|
+
parent: partition
|
204
|
+
name: partition
|
205
|
+
|
206
|
+
Theaters, Members, and Movies from DSL:
|
207
|
+
theater:
|
208
|
+
table: theaters
|
209
|
+
relationships:
|
210
|
+
members:
|
211
|
+
model: member
|
212
|
+
constraints:
|
213
|
+
- type: reference
|
214
|
+
parent: id
|
215
|
+
name: tid
|
216
|
+
- type: reference
|
217
|
+
parent: partition
|
218
|
+
name: partition
|
219
|
+
parent_theater:
|
220
|
+
model: theater
|
221
|
+
constraints:
|
222
|
+
- type: reference
|
223
|
+
name: id
|
224
|
+
parent: parent_theater_id
|
225
|
+
member:
|
226
|
+
table: members
|
227
|
+
relationships:
|
228
|
+
movies:
|
229
|
+
model: movie
|
230
|
+
constraints:
|
231
|
+
- type: reference
|
232
|
+
parent: id
|
233
|
+
name: member_id
|
234
|
+
demos:
|
235
|
+
model: demographic
|
236
|
+
constraints:
|
237
|
+
- type: reference
|
238
|
+
parent: id
|
239
|
+
name: member_id
|
240
|
+
favorite_comic_movies:
|
241
|
+
model: movie
|
242
|
+
constraints:
|
243
|
+
- type: reference
|
244
|
+
parent: id
|
245
|
+
name: member_id
|
246
|
+
- type: static
|
247
|
+
name: genre
|
248
|
+
value: comic
|
249
|
+
favorite_mystery_movies:
|
250
|
+
model: movie
|
251
|
+
constraints:
|
252
|
+
- type: reference
|
253
|
+
parent: id
|
254
|
+
name: member_id
|
255
|
+
- type: static
|
256
|
+
name: genre
|
257
|
+
value: mystery
|
258
|
+
favorite_comedy_movies:
|
259
|
+
model: movie
|
260
|
+
constraints:
|
261
|
+
- type: reference
|
262
|
+
parent: id
|
263
|
+
name: member_id
|
264
|
+
- type: static
|
265
|
+
name: genre
|
266
|
+
value: comedy
|
267
|
+
demographic:
|
268
|
+
table: demographics
|
269
|
+
relationships:
|
270
|
+
phone_numbers:
|
271
|
+
model: phone_number
|
272
|
+
constraints:
|
273
|
+
- type: reference
|
274
|
+
parent: id
|
275
|
+
name: demographic_id
|
276
|
+
phone_number:
|
277
|
+
table: phone_numbers
|
278
|
+
movie:
|
279
|
+
table: movies
|
280
|
+
|
122
281
|
Readme:
|
282
|
+
practice:
|
283
|
+
table: practices
|
284
|
+
relationships:
|
285
|
+
patients:
|
286
|
+
model: patient
|
287
|
+
constraints:
|
288
|
+
- type: reference
|
289
|
+
name: practice_id
|
290
|
+
parent: id
|
291
|
+
patient:
|
292
|
+
table: patients
|
293
|
+
relationships:
|
294
|
+
notes:
|
295
|
+
model: note
|
296
|
+
constraints:
|
297
|
+
- type: reference
|
298
|
+
name: patient_id
|
299
|
+
parent: id
|
300
|
+
work_phone_number:
|
301
|
+
model: phone_number
|
302
|
+
constraints:
|
303
|
+
- type: reference
|
304
|
+
name: patient_id
|
305
|
+
parent: id
|
306
|
+
- type: static
|
307
|
+
name: phone_number_type
|
308
|
+
value: work
|
309
|
+
cell_phone_number:
|
310
|
+
model: phone_number
|
311
|
+
constraints:
|
312
|
+
- type: reference
|
313
|
+
name: patient_id
|
314
|
+
parent: id
|
315
|
+
- type: static
|
316
|
+
name: phone_number_type
|
317
|
+
value: cell
|
318
|
+
fax_phone_number:
|
319
|
+
model: phone_number
|
320
|
+
constraints:
|
321
|
+
- type: reference
|
322
|
+
name: patient_id
|
323
|
+
parent: id
|
324
|
+
- type: static
|
325
|
+
name: phone_number_type
|
326
|
+
value: fax
|
327
|
+
note:
|
328
|
+
table: notes
|
329
|
+
phone_number:
|
330
|
+
table: phones
|
331
|
+
|
332
|
+
Readme Tree Based:
|
123
333
|
name: practice
|
124
334
|
table: practices
|
125
335
|
models:
|
@@ -161,63 +371,51 @@ Readme:
|
|
161
371
|
- type: static
|
162
372
|
name: phone_number_type
|
163
373
|
value: fax
|
374
|
+
|
164
375
|
Cycle Example:
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
table: cs
|
186
|
-
models:
|
187
|
-
- name: a
|
188
|
-
table: as
|
189
|
-
- name: d
|
190
|
-
table: ds
|
191
|
-
models:
|
192
|
-
- name: a
|
193
|
-
table: as
|
194
|
-
models:
|
195
|
-
- name: b1
|
196
|
-
table: bs
|
197
|
-
models:
|
198
|
-
- name: c
|
199
|
-
table: cs
|
376
|
+
a:
|
377
|
+
table: as
|
378
|
+
relationships:
|
379
|
+
b1:
|
380
|
+
model: b
|
381
|
+
b2:
|
382
|
+
model: b
|
383
|
+
b:
|
384
|
+
table: bs
|
385
|
+
relationships:
|
386
|
+
c:
|
387
|
+
d:
|
388
|
+
c:
|
389
|
+
table: cs
|
390
|
+
relationships:
|
391
|
+
a:
|
392
|
+
d:
|
393
|
+
table: ds
|
394
|
+
relationships:
|
395
|
+
a:
|
200
396
|
|
201
397
|
Partitioner Example 1:
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
398
|
+
dog:
|
399
|
+
table: animals
|
400
|
+
partitioners:
|
401
|
+
- name: type
|
402
|
+
value: Dog
|
403
|
+
- name: deleted
|
404
|
+
value: false
|
209
405
|
|
210
406
|
Partitioner Example 2:
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
407
|
+
owner:
|
408
|
+
table: owners
|
409
|
+
relationships:
|
410
|
+
dogs:
|
411
|
+
model: dog
|
412
|
+
constraints:
|
413
|
+
- name: owner_id
|
414
|
+
parent: id
|
415
|
+
dog:
|
416
|
+
table: animals
|
417
|
+
partitioners:
|
418
|
+
- name: type
|
419
|
+
value: Dog
|
420
|
+
- name: deleted
|
421
|
+
value: false
|
data/spec/spec_helper.rb
CHANGED
@@ -9,6 +9,13 @@
|
|
9
9
|
|
10
10
|
require 'yaml'
|
11
11
|
require 'pry'
|
12
|
+
require 'pry-byebug'
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
# Allow for disabling auto focus mode in certain environments like CI to
|
16
|
+
# prevent false positives when only a subset of the suite passes.
|
17
|
+
config.filter_run_when_matching :focus unless ENV['DISABLE_RSPEC_FOCUS'] == 'true'
|
18
|
+
end
|
12
19
|
|
13
20
|
unless ENV['DISABLE_SIMPLECOV'] == 'true'
|
14
21
|
require 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: pry-byebug
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rake
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,28 +120,56 @@ dependencies:
|
|
106
120
|
requirements:
|
107
121
|
- - "~>"
|
108
122
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
123
|
+
version: '1'
|
110
124
|
type: :development
|
111
125
|
prerelease: false
|
112
126
|
version_requirements: !ruby/object:Gem::Requirement
|
113
127
|
requirements:
|
114
128
|
- - "~>"
|
115
129
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
130
|
+
version: '1'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rubocop-rake
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rubocop-rspec
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
117
159
|
- !ruby/object:Gem::Dependency
|
118
160
|
name: simplecov
|
119
161
|
requirement: !ruby/object:Gem::Requirement
|
120
162
|
requirements:
|
121
163
|
- - "~>"
|
122
164
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.
|
165
|
+
version: 0.19.0
|
124
166
|
type: :development
|
125
167
|
prerelease: false
|
126
168
|
version_requirements: !ruby/object:Gem::Requirement
|
127
169
|
requirements:
|
128
170
|
- - "~>"
|
129
171
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.
|
172
|
+
version: 0.19.0
|
131
173
|
- !ruby/object:Gem::Dependency
|
132
174
|
name: simplecov-console
|
133
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +216,7 @@ files:
|
|
174
216
|
- lib/dbee/dsl/association_builder.rb
|
175
217
|
- lib/dbee/dsl/methods.rb
|
176
218
|
- lib/dbee/dsl/reflectable.rb
|
219
|
+
- lib/dbee/dsl_schema_builder.rb
|
177
220
|
- lib/dbee/key_chain.rb
|
178
221
|
- lib/dbee/key_path.rb
|
179
222
|
- lib/dbee/model.rb
|
@@ -182,6 +225,8 @@ files:
|
|
182
225
|
- lib/dbee/model/constraints/reference.rb
|
183
226
|
- lib/dbee/model/constraints/static.rb
|
184
227
|
- lib/dbee/model/partitioner.rb
|
228
|
+
- lib/dbee/model/relationships.rb
|
229
|
+
- lib/dbee/model/relationships/basic.rb
|
185
230
|
- lib/dbee/providers.rb
|
186
231
|
- lib/dbee/providers/null_provider.rb
|
187
232
|
- lib/dbee/query.rb
|
@@ -202,9 +247,14 @@ files:
|
|
202
247
|
- lib/dbee/query/sorters/ascending.rb
|
203
248
|
- lib/dbee/query/sorters/base.rb
|
204
249
|
- lib/dbee/query/sorters/descending.rb
|
250
|
+
- lib/dbee/schema.rb
|
251
|
+
- lib/dbee/schema_creator.rb
|
252
|
+
- lib/dbee/schema_from_tree_based_model.rb
|
253
|
+
- lib/dbee/util/make_keyed_by.rb
|
205
254
|
- lib/dbee/version.rb
|
206
255
|
- spec/dbee/base_spec.rb
|
207
256
|
- spec/dbee/constant_resolver_spec.rb
|
257
|
+
- spec/dbee/dsl_schema_builder_spec.rb
|
208
258
|
- spec/dbee/key_chain_spec.rb
|
209
259
|
- spec/dbee/key_path_spec.rb
|
210
260
|
- spec/dbee/model/constraints/base_spec.rb
|
@@ -220,6 +270,9 @@ files:
|
|
220
270
|
- spec/dbee/query/sorters/base_spec.rb
|
221
271
|
- spec/dbee/query/sorters/descending_spec.rb
|
222
272
|
- spec/dbee/query_spec.rb
|
273
|
+
- spec/dbee/schema_creator_spec.rb
|
274
|
+
- spec/dbee/schema_from_tree_based_model_spec.rb
|
275
|
+
- spec/dbee/schema_spec.rb
|
223
276
|
- spec/dbee_spec.rb
|
224
277
|
- spec/fixtures/models.rb
|
225
278
|
- spec/fixtures/models.yaml
|
@@ -233,7 +286,7 @@ metadata:
|
|
233
286
|
documentation_uri: https://www.rubydoc.info/gems/dbee
|
234
287
|
homepage_uri: https://github.com/bluemarblepayroll/dbee
|
235
288
|
source_code_uri: https://github.com/bluemarblepayroll/dbee
|
236
|
-
post_install_message:
|
289
|
+
post_install_message:
|
237
290
|
rdoc_options: []
|
238
291
|
require_paths:
|
239
292
|
- lib
|
@@ -249,12 +302,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
302
|
version: '0'
|
250
303
|
requirements: []
|
251
304
|
rubygems_version: 3.0.3
|
252
|
-
signing_key:
|
305
|
+
signing_key:
|
253
306
|
specification_version: 4
|
254
307
|
summary: Adhoc Reporting SQL Generator
|
255
308
|
test_files:
|
256
309
|
- spec/dbee/base_spec.rb
|
257
310
|
- spec/dbee/constant_resolver_spec.rb
|
311
|
+
- spec/dbee/dsl_schema_builder_spec.rb
|
258
312
|
- spec/dbee/key_chain_spec.rb
|
259
313
|
- spec/dbee/key_path_spec.rb
|
260
314
|
- spec/dbee/model/constraints/base_spec.rb
|
@@ -270,6 +324,9 @@ test_files:
|
|
270
324
|
- spec/dbee/query/sorters/base_spec.rb
|
271
325
|
- spec/dbee/query/sorters/descending_spec.rb
|
272
326
|
- spec/dbee/query_spec.rb
|
327
|
+
- spec/dbee/schema_creator_spec.rb
|
328
|
+
- spec/dbee/schema_from_tree_based_model_spec.rb
|
329
|
+
- spec/dbee/schema_spec.rb
|
273
330
|
- spec/dbee_spec.rb
|
274
331
|
- spec/fixtures/models.rb
|
275
332
|
- spec/fixtures/models.yaml
|