Module: PactBroker::Pacts::PactPublicationDatasetModule
Overview
rubocop: disable Metrics/ModuleLength
Instance Method Summary
collapse
-
#consumer_name_like(name) ⇒ Object
-
#consumer_version_number_like(number) ⇒ Object
-
#consumer_version_order_after(order) ⇒ Object
-
#consumer_version_order_before(order) ⇒ Object
-
#consumer_version_tag(tag) ⇒ Object
-
#created_after(date) ⇒ Object
-
#delete ⇒ Object
-
#eager_load_pact_versions ⇒ Object
-
#earliest ⇒ Object
-
#for_branch_heads(branch_name) ⇒ Object
Return the pacts (if they exist) for the branch heads.
-
#for_branch_name(branch_name) ⇒ Object
-
#for_consumer(consumer) ⇒ Object
-
#for_consumer_id_and_provider_id(consumer_id, provider_id) ⇒ Object
-
#for_consumer_name(consumer_name) ⇒ Object
-
#for_consumer_name_and_maybe_version_number(consumer_name, consumer_version_number) ⇒ Object
-
#for_consumer_version_tag(tag_name) ⇒ Object
-
#for_consumer_version_tag_all_revisions(tag_name) ⇒ Object
-
#for_latest_consumer_versions_with_tag(tag_name) ⇒ Object
The pacts for the latest versions with the specified tag (new logic) NOT the latest pact that belongs to a version with the specified tag.
-
#for_pact_version_id(pact_version_id) ⇒ Object
-
#for_pact_version_sha(pact_version_sha) ⇒ Object
-
#for_provider(provider) ⇒ Object
-
#for_provider_name(provider_name) ⇒ Object
-
#in_environments ⇒ Object
-
#join_consumer_branch_versions ⇒ Object
-
#join_consumer_version_tags(table_alias = :ct) ⇒ Object
-
#join_consumer_version_tags_with_names(consumer_version_tag_names) ⇒ Object
-
#join_consumer_versions(table_alias = :cv, extra_join_criteria = {}, &block) ⇒ Object
-
#join_consumers(table_alias = :consumers, base_table = :pact_publications, extra_join_criteria = {}) ⇒ Object
-
#join_pact_versions ⇒ Object
-
#join_providers(table_alias = :providers, base_table = :pact_publications, extra_join_criteria = {}) ⇒ Object
-
#latest ⇒ Object
-
#latest_by_consumer_branch ⇒ Object
TODO use the branch heads here.
-
#latest_by_consumer_tag ⇒ Object
The latest pact publication for each tag This uses the old logic of “the latest pact for a version that has a tag” (which always returns a pact) rather than “the pact for the latest version with a tag” Need to see about updating this.
-
#latest_by_consumer_version_order ⇒ Object
-
#latest_for_consumer_branch(branch_name) ⇒ Object
The pact that belongs to the branch head.
-
#latest_for_consumer_tag(tag_name) ⇒ Object
This uses the old logic of “the latest pact for a version that has a tag” (which always returns a pact) rather than “the pact for the latest version with a tag” Need to see about updating this.
-
#old_latest_for_consumer_branch(branch_name) ⇒ Object
The latest pact that belongs to a version on the specified branch (might not be the version that is the branch head) Always returns a pact, if any pacts exist for this branch.
-
#order_by_consumer_name ⇒ Object
-
#order_by_consumer_version_order ⇒ Object
-
#overall_latest ⇒ Object
-
#overall_latest_for_consumer_id_and_provider_id(consumer_id, provider_id) ⇒ Object
-
#provider_name_like(name) ⇒ Object
-
#remove_overridden_revisions(pact_publications_alias = :pact_publications) ⇒ Object
-
#remove_overridden_revisions_from_complete_query ⇒ Object
-
#tag(tag_name) ⇒ Object
-
#untagged ⇒ Object
-
#verified_before_date(date) ⇒ Object
-
#where_consumer_if_set(consumer) ⇒ Object
#for_currently_deployed_versions, #for_currently_supported_versions, #for_environment, #for_provider_and_consumer_version_selector, #latest_for_main_branches
Instance Method Details
#consumer_name_like(name) ⇒ Object
375
376
377
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 375
def consumer_name_like(name)
where(name_like(Sequel[:consumers][:name], name))
end
|
#consumer_version_number_like(number) ⇒ Object
379
380
381
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 379
def consumer_version_number_like(number)
where(name_like(Sequel[:cv][:number], number))
end
|
#consumer_version_order_after(order) ⇒ Object
391
392
393
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 391
def consumer_version_order_after order
where(Sequel.lit("consumer_version_order > ?", order))
end
|
#consumer_version_order_before(order) ⇒ Object
387
388
389
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 387
def consumer_version_order_before order
where(Sequel.lit("consumer_version_order < ?", order))
end
|
#consumer_version_tag(tag) ⇒ Object
383
384
385
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 383
def consumer_version_tag(tag)
where(name_like(Sequel[:ct][:name],tag))
end
|
#created_after(date) ⇒ Object
281
282
283
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 281
def created_after date
where(Sequel.lit("#{first_source_alias}.created_at > ?", date))
end
|
#delete ⇒ Object
423
424
425
426
427
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 423
def delete
require "pact_broker/webhooks/triggered_webhook"
PactBroker::Webhooks::TriggeredWebhook.where(pact_publication: self).delete
super
end
|
#eager_load_pact_versions ⇒ Object
348
349
350
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 348
def eager_load_pact_versions
eager(:pact_versions)
end
|
#earliest ⇒ Object
407
408
409
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 407
def earliest
order(:consumer_version_order).limit(1)
end
|
#for_branch_heads(branch_name) ⇒ Object
Return the pacts (if they exist) for the branch heads. This uses the new logic of finding the branch head and returning any associated pacts, rather than the old logic of returning the pact for the latest version on the branch that had a pact.
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 119
def for_branch_heads(branch_name)
branch_head_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_heads][:version_id],
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:branch_heads][:branch_name].as(:branch_name))
end
base_query
.join(:branch_heads, branch_head_join) do
name_like(Sequel[:branch_heads][:branch_name], branch_name)
end
.remove_overridden_revisions_from_complete_query
end
|
#for_branch_name(branch_name) ⇒ Object
357
358
359
360
361
362
363
364
365
366
367
368
369
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 357
def for_branch_name branch_name
branch_versions_join = {
Sequel[:branch_versions][:version_id] => Sequel[:pact_publications][:consumer_version_id],
Sequel[:branch_versions][:branch_name] => branch_name
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:branch_versions][:branch_name].as(:branch_name))
end
base_query.join(:branch_versions, branch_versions_join)
end
|
#for_consumer(consumer) ⇒ Object
26
27
28
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 26
def for_consumer consumer
where(consumer: consumer)
end
|
#for_consumer_id_and_provider_id(consumer_id, provider_id) ⇒ Object
10
11
12
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 10
def for_consumer_id_and_provider_id(consumer_id, provider_id)
where(Sequel[:pact_publications][:consumer_id] => consumer_id, Sequel[:pact_publications][:provider_id] => provider_id)
end
|
#for_consumer_name(consumer_name) ⇒ Object
18
19
20
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 18
def for_consumer_name(consumer_name)
where(consumer: PactBroker::Domain::Pacticipant.find_by_name(consumer_name))
end
|
#for_consumer_name_and_maybe_version_number(consumer_name, consumer_version_number) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 52
def for_consumer_name_and_maybe_version_number(consumer_name, consumer_version_number)
if consumer_version_number
where(consumer_version: PactBroker::Domain::Version.where_pacticipant_name_and_version_number(consumer_name, consumer_version_number))
else
where(consumer: PactBroker::Domain::Pacticipant.find_by_name(consumer_name))
end
end
|
#for_consumer_version_tag(tag_name) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 35
def for_consumer_version_tag tag_name
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:tags][:name].as(:tag_name))
end
base_query
.join(:tags, { version_id: :consumer_version_id, Sequel[:tags][:name] => tag_name })
.remove_overridden_revisions_from_complete_query
end
|
#for_consumer_version_tag_all_revisions(tag_name) ⇒ Object
46
47
48
49
50
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 46
def for_consumer_version_tag_all_revisions tag_name
join(:tags, { version_id: :consumer_version_id }) do
name_like(Sequel[:tags][:name], tag_name)
end
end
|
#for_latest_consumer_versions_with_tag(tag_name) ⇒ Object
The pacts for the latest versions with the specified tag (new logic) NOT the latest pact that belongs to a version with the specified tag.
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 235
def for_latest_consumer_versions_with_tag(tag_name)
head_tags = PactBroker::Domain::Tag
.select_group(:pacticipant_id, :name)
.select_append{ max(version_order).as(:latest_version_order) }
.where(name: tag_name)
head_tags_join = {
Sequel[:pact_publications][:consumer_id] => Sequel[:head_tags][:pacticipant_id],
Sequel[:pact_publications][:consumer_version_order] => Sequel[:head_tags][:latest_version_order]
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:head_tags][:name].as(:tag_name))
end
base_query
.join(head_tags, head_tags_join, { table_alias: :head_tags })
.remove_overridden_revisions_from_complete_query
end
|
#for_pact_version_id(pact_version_id) ⇒ Object
297
298
299
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 297
def for_pact_version_id(pact_version_id)
where(Sequel[:pact_publications][:pact_version_id] => pact_version_id)
end
|
#for_pact_version_sha(pact_version_sha) ⇒ Object
343
344
345
346
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 343
def for_pact_version_sha(pact_version_sha)
join_pact_versions
.where(Sequel[:pact_versions][:sha] => pact_version_sha)
end
|
#for_provider(provider) ⇒ Object
22
23
24
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 22
def for_provider provider
where(provider: provider)
end
|
#for_provider_name(provider_name) ⇒ Object
14
15
16
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 14
def for_provider_name(provider_name)
where(provider: PactBroker::Domain::Pacticipant.find_by_name(provider_name))
end
|
#in_environments ⇒ Object
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 256
def in_environments
currently_deployed_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:currently_deployed_version_ids][:version_id]
}
released_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:released_versions][:version_id],
Sequel[:released_versions][:support_ended_at] => nil
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified
end
deployed = base_query.join(:currently_deployed_version_ids, currently_deployed_join)
released = base_query.join(:released_versions, released_join)
deployed.union(released).remove_overridden_revisions_from_complete_query
end
|
#join_consumer_branch_versions ⇒ Object
312
313
314
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 312
def join_consumer_branch_versions
join(:branch_versions, { Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_versions][:version_id] })
end
|
308
309
310
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 308
def join_consumer_version_tags(table_alias = :ct)
join(:tags, { Sequel[table_alias][:version_id] => Sequel[:pact_publications][:consumer_version_id]}, { table_alias: table_alias })
end
|
316
317
318
319
320
321
322
323
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 316
def join_consumer_version_tags_with_names(consumer_version_tag_names)
join(:tags, {
Sequel[:ct][:version_id] => Sequel[:pact_publications][:consumer_version_id],
Sequel[:ct][:name] => consumer_version_tag_names
}, {
table_alias: :ct
})
end
|
#join_consumer_versions(table_alias = :cv, extra_join_criteria = {}, &block) ⇒ Object
301
302
303
304
305
306
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 301
def join_consumer_versions(table_alias = :cv, = {}, &block)
versions_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[table_alias][:id]
}.merge()
join(:versions, versions_join, { table_alias: table_alias }, &block)
end
|
#join_consumers(table_alias = :consumers, base_table = :pact_publications, extra_join_criteria = {}) ⇒ Object
332
333
334
335
336
337
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 332
def join_consumers(table_alias = :consumers, base_table = :pact_publications, = {})
consumer_join = {
Sequel[base_table][:consumer_id] => Sequel[table_alias][:id]
}.merge()
join(:pacticipants, consumer_join, { table_alias: table_alias })
end
|
#join_pact_versions ⇒ Object
339
340
341
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 339
def join_pact_versions
join(:pact_versions, { Sequel[:pact_publications][:pact_version_id] => Sequel[:pact_versions][:id] })
end
|
#join_providers(table_alias = :providers, base_table = :pact_publications, extra_join_criteria = {}) ⇒ Object
325
326
327
328
329
330
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 325
def join_providers(table_alias = :providers, base_table = :pact_publications, = {})
provider_join = {
Sequel[base_table][:provider_id] => Sequel[table_alias][:id]
}.merge()
join(:pacticipants, provider_join, { table_alias: table_alias })
end
|
#latest ⇒ Object
411
412
413
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 411
def latest
order(:consumer_version_order, :revision_number).last
end
|
#latest_by_consumer_branch ⇒ Object
TODO use the branch heads here
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 61
def latest_by_consumer_branch
branch_versions_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_versions][:version_id]
}
branches_join = {
Sequel[:branch_versions][:branch_id] => Sequel[:branches][:id]
}
max_orders = join(:branch_versions, branch_versions_join)
.join(:branches, branches_join)
.select_group(Sequel[:pact_publications][:consumer_id], Sequel[:pact_publications][:provider_id], Sequel[:branches][:name].as(:branch_name))
.select_append{ max(consumer_version_order).as(latest_consumer_version_order) }
max_join = {
Sequel[:max_orders][:consumer_id] => Sequel[:pact_publications][:consumer_id],
Sequel[:max_orders][:provider_id] => Sequel[:pact_publications][:provider_id],
Sequel[:max_orders][:latest_consumer_version_order] => Sequel[:pact_publications][:consumer_version_order]
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:max_orders][:branch_name].as(:branch_name))
end
base_query
.remove_overridden_revisions
.join(max_orders, max_join, { table_alias: :max_orders })
end
|
#latest_by_consumer_tag ⇒ Object
The latest pact publication for each tag This uses the old logic of “the latest pact for a version that has a tag” (which always returns a pact) rather than “the pact for the latest version with a tag” Need to see about updating this.
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 178
def latest_by_consumer_tag
tags_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:tags][:version_id],
}
max_orders = join(:tags, tags_join)
.select_group(:consumer_id, :provider_id, Sequel[:tags][:name].as(:tag_name))
.select_append{ max(consumer_version_order).as(latest_consumer_version_order) }
max_join = {
Sequel[:max_orders][:consumer_id] => Sequel[:pact_publications][:consumer_id],
Sequel[:max_orders][:provider_id] => Sequel[:pact_publications][:provider_id],
Sequel[:max_orders][:latest_consumer_version_order] => Sequel[:pact_publications][:consumer_version_order]
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:max_orders][:tag_name])
end
base_query
.join(max_orders, max_join, { table_alias: :max_orders })
.remove_overridden_revisions_from_complete_query
end
|
#latest_by_consumer_version_order ⇒ Object
395
396
397
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 395
def latest_by_consumer_version_order
reverse_order(:consumer_version_order).limit(1)
end
|
#latest_for_consumer_branch(branch_name) ⇒ Object
The pact that belongs to the branch head. May return nil if the branch head does not have a pact published for it.
138
139
140
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 138
def latest_for_consumer_branch(branch_name)
for_branch_heads(branch_name)
end
|
#latest_for_consumer_tag(tag_name) ⇒ Object
This uses the old logic of “the latest pact for a version that has a tag” (which always returns a pact) rather than “the pact for the latest version with a tag” Need to see about updating this.
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 206
def latest_for_consumer_tag(tag_name)
tags_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:tags][:version_id],
Sequel[:tags][:name] => tag_name
}
max_orders = join(:tags, tags_join)
.select_group(:consumer_id, :provider_id, Sequel[:tags][:name].as(:tag_name))
.select_append{ max(consumer_version_order).as(latest_consumer_version_order) }
max_join = {
Sequel[:max_orders][:consumer_id] => Sequel[:pact_publications][:consumer_id],
Sequel[:max_orders][:provider_id] => Sequel[:pact_publications][:provider_id],
Sequel[:max_orders][:latest_consumer_version_order] => Sequel[:pact_publications][:consumer_version_order]
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:max_orders][:tag_name])
end
base_query
.join(max_orders, max_join, { table_alias: :max_orders })
.remove_overridden_revisions_from_complete_query
end
|
#old_latest_for_consumer_branch(branch_name) ⇒ Object
The latest pact that belongs to a version on the specified branch (might not be the version that is the branch head) Always returns a pact, if any pacts exist for this branch.
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 144
def old_latest_for_consumer_branch(branch_name)
branch_versions_join = {
Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_versions][:version_id]
}
branches_join = {
Sequel[:branch_versions][:branch_id] => Sequel[:branches][:id],
Sequel[:branches][:name] => branch_name
}
max_orders = join(:branch_versions, branch_versions_join)
.join(:branches, branches_join)
.select_group(Sequel[:pact_publications][:consumer_id], Sequel[:pact_publications][:provider_id], Sequel[:branches][:name].as(:branch_name))
.select_append{ max(consumer_version_order).as(latest_consumer_version_order) }
max_join = {
Sequel[:max_orders][:consumer_id] => Sequel[:pact_publications][:consumer_id],
Sequel[:max_orders][:provider_id] => Sequel[:pact_publications][:provider_id],
Sequel[:max_orders][:latest_consumer_version_order] => Sequel[:pact_publications][:consumer_version_order]
}
base_query = self
if no_columns_selected?
base_query = base_query.select_all_qualified.select_append(Sequel[:max_orders][:branch_name].as(:branch_name))
end
base_query
.join(max_orders, max_join, { table_alias: :max_orders })
.remove_overridden_revisions_from_complete_query
end
|
#order_by_consumer_name ⇒ Object
399
400
401
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 399
def order_by_consumer_name
order_append_ignore_case(Sequel[:consumers][:name])
end
|
#order_by_consumer_version_order ⇒ Object
403
404
405
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 403
def order_by_consumer_version_order
order_append(:consumer_version_order, :revision_number)
end
|
#overall_latest ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 91
def overall_latest
self_join = {
Sequel[:pact_publications][:consumer_id] => Sequel[:pp2][:consumer_id],
Sequel[:pact_publications][:provider_id] => Sequel[:pp2][:provider_id],
Sequel[:pact_publications][:consumer_version_order] => Sequel[:pp2][:max_consumer_version_order]
}
base_query = self
base_query = base_query.select_all_qualified if no_columns_selected?
base_query.join(
base_query.select_group(:consumer_id, :provider_id).select_append{ max(:consumer_version_order).as(:max_consumer_version_order) },
self_join,
table_alias: :pp2
)
.remove_overridden_revisions_from_complete_query
end
|
#overall_latest_for_consumer_id_and_provider_id(consumer_id, provider_id) ⇒ Object
109
110
111
112
113
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 109
def overall_latest_for_consumer_id_and_provider_id(consumer_id, provider_id)
for_consumer_id_and_provider_id(consumer_id, provider_id)
.order(Sequel.desc(Sequel[:pact_publications][:consumer_version_order]), Sequel.desc(:revision_number))
.limit(1)
end
|
#provider_name_like(name) ⇒ Object
371
372
373
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 371
def provider_name_like(name)
where(name_like(Sequel[:providers][:name], name))
end
|
#remove_overridden_revisions(pact_publications_alias = :pact_publications) ⇒ Object
285
286
287
288
289
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 285
def remove_overridden_revisions(pact_publications_alias = :pact_publications)
base = self
base = base.select_all_qualified if no_columns_selected?
base.join(:latest_pact_publication_ids_for_consumer_versions, { Sequel[:lp][:pact_publication_id] => Sequel[pact_publications_alias][:id] }, { table_alias: :lp})
end
|
#remove_overridden_revisions_from_complete_query ⇒ Object
291
292
293
294
295
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 291
def remove_overridden_revisions_from_complete_query
from_self(alias: :pact_publications)
.select(Sequel[:pact_publications].*)
.remove_overridden_revisions(:pact_publications)
end
|
#tag(tag_name) ⇒ Object
352
353
354
355
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 352
def tag tag_name
filter = name_like(Sequel.qualify(:tags, :name), tag_name)
join(:tags, {version_id: :consumer_version_id}).where(filter)
end
|
#untagged ⇒ Object
30
31
32
33
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 30
def untagged
left_outer_join(:tags, { version_id: :consumer_version_id })
.where(Sequel.qualify(:tags, :name) => nil)
end
|
#verified_before_date(date) ⇒ Object
277
278
279
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 277
def verified_before_date(date)
where { Sequel[:verifications][:execution_date] < date }
end
|
#where_consumer_if_set(consumer) ⇒ Object
415
416
417
418
419
420
421
|
# File 'lib/pact_broker/pacts/pact_publication_dataset_module.rb', line 415
def where_consumer_if_set(consumer)
if consumer
where(consumer: consumer)
else
self
end
end
|