pact_broker 2.24.0 → 2.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/CONTRIBUTING.md +2 -2
  4. data/DEVELOPER_DOCUMENTATION.md +31 -27
  5. data/DEVELOPER_SETUP.md +3 -2
  6. data/config/database.yml +10 -0
  7. data/db/ddl_statements.rb +3 -0
  8. data/db/ddl_statements/head_matrix_v001.rb +31 -0
  9. data/db/ddl_statements/head_matrix_v002.rb +31 -0
  10. data/db/ddl_statements/latest_verification_ids_for_pact_versions_v001.rb +4 -0
  11. data/db/migrations/000028_create_all_pact_publications.rb +4 -1
  12. data/db/migrations/20180311_optimise_head_matrix.rb +5 -34
  13. data/db/migrations/20180523_create_latest_verifications_for_consumer_version_tags.rb +2 -0
  14. data/db/migrations/20180612_add_pacticipant_ids_to_verifications.rb +17 -0
  15. data/db/migrations/20180613_migrate_pacticipant_ids_for_verifications.rb +7 -0
  16. data/db/migrations/20180614_update_latest_verification_ids_for_consumer_and_provider.rb +27 -0
  17. data/db/migrations/20180615_add_consumer_id_to_pact_publications.rb +13 -0
  18. data/db/migrations/20180616_migrate_consumer_ids_for_pact_publications.rb +11 -0
  19. data/db/migrations/20180720_create_latest_pact_publication_ids.rb +25 -0
  20. data/db/migrations/20180721_migrate_latest_pact_publication_ids.rb +11 -0
  21. data/db/migrations/20180722_recreate_views.rb +43 -0
  22. data/db/migrations/20180723_create_latest_verification_ids.rb +23 -0
  23. data/db/migrations/20180724_migrate_latest_verification_ids.rb +18 -0
  24. data/db/migrations/20180726_recreate_views.rb +29 -0
  25. data/db/migrations/20180727_recreate_latest_verification_ids_for_consumer_version_tags.rb +34 -0
  26. data/db/migrations/20180728_truncate_materialized_matrix_tables.rb +20 -0
  27. data/db/migrations/20180729_create_latest_verification_ids_for_provider_versions.rb +8 -0
  28. data/db/migrations/20180730_create_latest_verifications_for_provider_versions.rb +33 -0
  29. data/db/migrations/20180731_update_head_matrix.rb +11 -0
  30. data/db/pact_broker_database.sqlite3 +0 -0
  31. data/lib/pact_broker/api.rb +3 -3
  32. data/lib/pact_broker/api/decorators/dashboard_text_decorator.rb +2 -2
  33. data/lib/pact_broker/api/pact_broker_urls.rb +1 -1
  34. data/lib/pact_broker/api/resources/base_resource.rb +0 -7
  35. data/lib/pact_broker/api/resources/index.rb +11 -9
  36. data/lib/pact_broker/api/resources/pact.rb +1 -3
  37. data/lib/pact_broker/api/resources/pacticipant.rb +1 -3
  38. data/lib/pact_broker/api/resources/tag.rb +1 -4
  39. data/lib/pact_broker/api/resources/verification.rb +2 -0
  40. data/lib/pact_broker/api/resources/version.rb +1 -3
  41. data/lib/pact_broker/app.rb +8 -0
  42. data/lib/pact_broker/certificates/certificate.rb +12 -0
  43. data/lib/pact_broker/config/setting.rb +12 -0
  44. data/lib/pact_broker/configuration.rb +2 -1
  45. data/lib/pact_broker/db.rb +6 -0
  46. data/lib/pact_broker/db/clean.rb +2 -7
  47. data/lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications.rb +29 -0
  48. data/lib/pact_broker/db/data_migrations/set_pacticipant_ids_for_verifications.rb +35 -0
  49. data/lib/pact_broker/db/migrate_data.rb +14 -0
  50. data/lib/pact_broker/doc/views/wip-provider-pacts.markdown +3 -0
  51. data/lib/pact_broker/domain/label.rb +12 -0
  52. data/lib/pact_broker/domain/pacticipant.rb +32 -1
  53. data/lib/pact_broker/domain/tag.rb +14 -1
  54. data/lib/pact_broker/domain/verification.rb +29 -0
  55. data/lib/pact_broker/domain/version.rb +25 -1
  56. data/lib/pact_broker/feature_toggle.rb +23 -0
  57. data/lib/pact_broker/index/service.rb +1 -0
  58. data/lib/pact_broker/matrix/head_row.rb +25 -20
  59. data/lib/pact_broker/matrix/repository.rb +0 -18
  60. data/lib/pact_broker/matrix/row.rb +24 -27
  61. data/lib/pact_broker/matrix/service.rb +0 -8
  62. data/lib/pact_broker/pacts/all_pact_publications.rb +15 -0
  63. data/lib/pact_broker/pacts/latest_pact_publication_id_by_consumer_version.rb +34 -0
  64. data/lib/pact_broker/pacts/latest_pact_publications.rb +15 -0
  65. data/lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb +15 -0
  66. data/lib/pact_broker/pacts/latest_tagged_pact_publications.rb +16 -0
  67. data/lib/pact_broker/pacts/pact_publication.rb +24 -0
  68. data/lib/pact_broker/pacts/pact_version.rb +20 -0
  69. data/lib/pact_broker/pacts/repository.rb +37 -11
  70. data/lib/pact_broker/pacts/service.rb +9 -2
  71. data/lib/pact_broker/repositories/helpers.rb +20 -0
  72. data/lib/pact_broker/tags/tag_with_latest_flag.rb +8 -0
  73. data/lib/pact_broker/ui/view_models/index_item.rb +5 -1
  74. data/lib/pact_broker/ui/views/index/show.haml +1 -1
  75. data/lib/pact_broker/verifications/all_verifications.rb +13 -0
  76. data/lib/pact_broker/verifications/latest_verification_for_consumer_and_provider.rb +18 -0
  77. data/lib/pact_broker/verifications/latest_verification_for_consumer_version_tag.rb +19 -0
  78. data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +22 -0
  79. data/lib/pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version.rb +36 -0
  80. data/lib/pact_broker/verifications/repository.rb +23 -5
  81. data/lib/pact_broker/verifications/sequence.rb +4 -0
  82. data/lib/pact_broker/version.rb +1 -1
  83. data/lib/pact_broker/webhooks/execution.rb +16 -0
  84. data/lib/pact_broker/webhooks/latest_triggered_webhook.rb +14 -0
  85. data/lib/pact_broker/webhooks/triggered_webhook.rb +27 -0
  86. data/lib/pact_broker/webhooks/webhook.rb +26 -0
  87. data/lib/pact_broker/webhooks/webhook_event.rb +13 -0
  88. data/pact_broker.gemspec +1 -0
  89. data/script/recreate-docker-pg-db.sh +20 -0
  90. data/script/recreate-mysql-db.sh +1 -0
  91. data/spec/integration/webhooks/certificate_spec.rb +1 -1
  92. data/spec/lib/pact_broker/db/clean_spec.rb +1 -1
  93. data/spec/lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications_spec.rb +40 -0
  94. data/spec/lib/pact_broker/feature_toggle_spec.rb +74 -0
  95. data/spec/lib/pact_broker/matrix/head_row_spec.rb +0 -44
  96. data/spec/lib/pact_broker/matrix/repository_spec.rb +0 -20
  97. data/spec/lib/pact_broker/matrix/row_spec.rb +0 -56
  98. data/spec/lib/pact_broker/pacts/repository_spec.rb +61 -9
  99. data/spec/lib/pact_broker/pacts/service_spec.rb +65 -17
  100. data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +3 -2
  101. data/spec/migrations/44_add_provider_version_to_verification_spec.rb +0 -1
  102. data/spec/service_consumers/provider_states_for_pact_ruby.rb +14 -0
  103. data/spec/support/test_data_builder.rb +0 -18
  104. data/tasks/database/annotate.rb +40 -0
  105. data/tasks/db.rake +12 -0
  106. metadata +50 -3
  107. data/lib/pact_broker/verifications/latest_verifications_by_consumer_version.rb +0 -15
@@ -0,0 +1,11 @@
1
+ Sequel.migration do
2
+ up do
3
+ # The danger with this migration is that a pact publication created by an old node will be lost
4
+ rows = from(:latest_pact_publications_by_consumer_versions).select(:consumer_id, :consumer_version_id, :provider_id, :id, :pact_version_id)
5
+ from(:latest_pact_publication_ids_for_consumer_versions).insert(rows)
6
+ end
7
+
8
+ down do
9
+ from(:latest_pact_publication_ids_for_consumer_versions).delete
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ Sequel.migration do
2
+ up do
3
+ # Latest pact_publication details for each provider/consumer version
4
+ create_or_replace_view(:latest_pact_publications_by_consumer_versions,
5
+ "select app.*
6
+ from latest_pact_publication_ids_for_consumer_versions lpp
7
+ inner join all_pact_publications app
8
+ on lpp.consumer_version_id = app.consumer_version_id
9
+ and lpp.pact_publication_id = app.id
10
+ and lpp.provider_id = app.provider_id"
11
+ )
12
+
13
+ # Latest consumer version order for consumer/provider
14
+ # Recreate latest_pact_publication_ids_for_consumer_versions view
15
+ lpp = :latest_pact_publication_ids_for_consumer_versions
16
+ latest_pact_consumer_version_orders = from(lpp).select_group(
17
+ Sequel[lpp][:provider_id],
18
+ Sequel[:cv][:pacticipant_id].as(:consumer_id))
19
+ .select_append{ max(order).as(latest_consumer_version_order) }
20
+ .join(:versions, { Sequel[lpp][:consumer_version_id] => Sequel[:cv][:id] }, { table_alias: :cv })
21
+
22
+ create_or_replace_view(:latest_pact_consumer_version_orders, latest_pact_consumer_version_orders)
23
+ end
24
+
25
+ down do
26
+ # Latest pact_publication details for each provider/consumer version
27
+ create_or_replace_view(:latest_pact_publications_by_consumer_versions,
28
+ "select app.*
29
+ from all_pact_publications app
30
+ inner join latest_pact_publication_revision_numbers lr
31
+ on app.consumer_id = lr.consumer_id
32
+ and app.provider_id = lr.provider_id
33
+ and app.consumer_version_order = lr.consumer_version_order
34
+ and app.revision_number = lr.latest_revision_number"
35
+ )
36
+
37
+ create_or_replace_view(:latest_pact_consumer_version_orders,
38
+ "select provider_id, consumer_id, max(consumer_version_order) as latest_consumer_version_order
39
+ from all_pact_publications
40
+ group by provider_id, consumer_id"
41
+ )
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ Sequel.migration do
2
+ up do
3
+ # Latest verification_id for each pact version/provider version.
4
+ # Keeping track of this in a table rather than having to calculate the
5
+ # latest revision speeds queries up.
6
+ # There is no way to delete an individual verification result yet, but when there
7
+ # is, we'll need to re-calculate the latest.
8
+ create_table(:latest_verification_id_for_pact_version_and_provider_version, charset: 'utf8') do
9
+ foreign_key :consumer_id, :pacticipants, null: false, on_delete: :cascade, foreign_key_constraint_name: 'latest_v_id_for_pv_and_pv_consumer_id_fk' # not required, but useful to avoid extra joins
10
+ foreign_key :pact_version_id, :pact_versions, null: false, on_delete: :cascade, foreign_key_constraint_name: 'latest_v_id_for_pv_and_pv_pact_version_id_fk'
11
+ foreign_key :provider_id, :pacticipants, null: false, on_delete: :cascade, foreign_key_constraint_name: 'latest_v_id_for_pv_and_pv_provider_id_fk' # not required, but useful to avoid extra joins
12
+ foreign_key :provider_version_id, :versions, null: false, on_delete: :cascade, foreign_key_constraint_name: 'latest_v_id_for_pv_and_pv_provider_version_id_fk'
13
+ foreign_key :verification_id, :verifications, null: false, on_delete: :cascade, foreign_key_constraint_name: 'latest_v_id_for_pv_and_pv_verification_id_fk'
14
+ index [:verification_id], unique: true, name: "latest_v_id_for_pv_and_pv_v_id_unq"
15
+ index [:pact_version_id, :provider_version_id], unique: true, name: "latest_v_id_for_pv_and_pv_pv_id_pv_id_unq"
16
+ index [:pact_version_id, :verification_id], name: "latest_v_id_for_pv_and_pv_pv_id_v_id"
17
+ end
18
+ end
19
+
20
+ down do
21
+ drop_table(:latest_verification_id_for_pact_version_and_provider_version)
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ Sequel.migration do
2
+ up do
3
+ # consumer_id and provider_id are redundant by avoid making extra joins when creating views
4
+ rows = from(:verifications).select_group(
5
+ Sequel[:verifications][:consumer_id],
6
+ Sequel[:verifications][:pact_version_id],
7
+ Sequel[:verifications][:provider_id],
8
+ Sequel[:verifications][:provider_version_id])
9
+ .select_append{ max(verifications[id]).as(verification_id) }
10
+
11
+ # The danger with this migration is that a verification created by an old node will be lost
12
+ from(:latest_verification_id_for_pact_version_and_provider_version).insert(rows)
13
+ end
14
+
15
+ down do
16
+ from(:latest_verification_id_for_pact_version_and_provider_version).delete
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ Sequel.migration do
2
+ up do
3
+ # joining with latest_pact_publication_revision_numbers gets rid of the overwritten
4
+ # pact revisions, and the max(verification_id) gets rid of the overwritten
5
+ # verifications
6
+ create_or_replace_view(:latest_verification_id_for_consumer_version_and_provider_version,
7
+ "select pp.consumer_version_id, lv.provider_version_id, lv.verification_id as latest_verification_id
8
+ from latest_pact_publication_ids_for_consumer_versions lpp
9
+ inner join pact_publications pp
10
+ on pp.id = lpp.pact_publication_id
11
+ left outer join latest_verification_id_for_pact_version_and_provider_version lv
12
+ on lv.pact_version_id = pp.pact_version_id"
13
+ )
14
+ end
15
+
16
+ down do
17
+ create_or_replace_view(:latest_verification_id_for_consumer_version_and_provider_version,
18
+ "select consumer_version_id, provider_version_id, max(verification_id) as latest_verification_id
19
+ from matrix
20
+ inner join latest_pact_publication_revision_numbers lr
21
+ on matrix.consumer_id = lr.consumer_id
22
+ and matrix.provider_id = lr.provider_id
23
+ and matrix.consumer_version_order = lr.consumer_version_order
24
+ and matrix.pact_revision_number = lr.latest_revision_number
25
+ group by consumer_version_id, provider_version_id"
26
+ )
27
+
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ Sequel.migration do
2
+ up do
3
+ create_or_replace_view(:latest_verification_ids_for_consumer_version_tags,
4
+ "select
5
+ v.provider_id,
6
+ v.consumer_id,
7
+ t.name as consumer_version_tag_name,
8
+ max(v.verification_id) as latest_verification_id
9
+ from latest_verification_id_for_pact_version_and_provider_version v
10
+ join latest_pact_publication_ids_for_consumer_versions lpp
11
+ on v.pact_version_id = lpp.pact_version_id
12
+ join tags t
13
+ on lpp.consumer_version_id = t.version_id
14
+ group by v.provider_id, v.consumer_id, t.name")
15
+ end
16
+
17
+ down do
18
+ # The latest verification id for each consumer version tag
19
+ create_or_replace_view(:latest_verification_ids_for_consumer_version_tags,
20
+ "select
21
+ pv.pacticipant_id as provider_id,
22
+ lpp.consumer_id,
23
+ t.name as consumer_version_tag_name,
24
+ max(v.id) as latest_verification_id
25
+ from verifications v
26
+ join latest_pact_publications_by_consumer_versions lpp
27
+ on v.pact_version_id = lpp.pact_version_id
28
+ join tags t
29
+ on lpp.consumer_version_id = t.version_id
30
+ join versions pv
31
+ on v.provider_version_id = pv.id
32
+ group by pv.pacticipant_id, lpp.consumer_id, t.name")
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ Sequel.migration do
2
+ up do
3
+ from(:materialized_matrix).delete
4
+ from(:materialized_head_matrix).delete
5
+
6
+ # TODO
7
+ # drop_view(:latest_matrix)
8
+ # drop_view(:latest_verification_id_for_consumer_version_and_provider)
9
+ # drop_view(:latest_matrix_for_consumer_version_and_provider_version)
10
+ # drop_table(:materialized_matrix)
11
+ # drop_table(:materialized_head_matrix)
12
+ end
13
+
14
+ down do
15
+ from(:materialized_matrix).delete
16
+ from(:materialized_matrix).insert(from(:matrix).select_all)
17
+ from(:materialized_head_matrix).delete
18
+ from(:materialized_head_matrix).insert(from(:head_matrix).select_all)
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ require_relative '../ddl_statements'
2
+
3
+ Sequel.migration do
4
+ change do
5
+ create_view(:latest_verification_ids_for_pact_versions,
6
+ LATEST_VERIFICATION_IDS_FOR_PACT_VERSIONS_V1)
7
+ end
8
+ end
@@ -0,0 +1,33 @@
1
+ Sequel.migration do
2
+ up do
3
+ # The most recent verification for each pact_version
4
+ v = :verifications
5
+ create_view(:latest_verifications_for_pact_versions,
6
+ from(v)
7
+ .select(
8
+ Sequel[v][:id],
9
+ Sequel[v][:number],
10
+ Sequel[v][:success],
11
+ Sequel[v][:build_url],
12
+ Sequel[v][:pact_version_id],
13
+ Sequel[v][:execution_date],
14
+ Sequel[v][:created_at],
15
+ Sequel[v][:provider_version_id],
16
+ Sequel[:s][:number].as(:provider_version_number),
17
+ Sequel[:s][:order].as(:provider_version_order))
18
+ .join(:latest_verification_ids_for_pact_versions,
19
+ {
20
+ Sequel[v][:pact_version_id] => Sequel[:lv][:pact_version_id],
21
+ Sequel[v][:id] => Sequel[:lv][:latest_verification_id]
22
+ }, { table_alias: :lv })
23
+ .join(:versions,
24
+ {
25
+ Sequel[v][:provider_version_id] => Sequel[:s][:id]
26
+ }, { table_alias: :s })
27
+ )
28
+ end
29
+
30
+ down do
31
+ drop_view(:latest_verifications_for_pact_versions)
32
+ end
33
+ end
@@ -0,0 +1,11 @@
1
+ Sequel.migration do
2
+ up do
3
+ create_or_replace_view(:head_matrix, HEAD_MATRIX_V2)
4
+ #TODO
5
+ #drop_view(:latest_verifications)
6
+ end
7
+
8
+ down do
9
+ create_or_replace_view(:head_matrix, HEAD_MATRIX_V1)
10
+ end
11
+ end
Binary file
@@ -1,5 +1,6 @@
1
1
  require 'webmachine/adapters/rack_mapped'
2
2
  require 'pact_broker/api/resources'
3
+ require 'pact_broker/feature_toggle'
3
4
 
4
5
  module PactBroker
5
6
 
@@ -40,9 +41,8 @@ module PactBroker
40
41
  add ['pacts', 'provider', :provider_name, 'latest', :tag], Api::Resources::LatestProviderPacts, {resource_name: "latest_tagged_provider_pact_publications"}
41
42
  add ['pacts', 'latest'], Api::Resources::LatestPacts, {resource_name: "latest_pacts"}
42
43
 
43
- if ENV['RACK_ENV'] != 'production'
44
- add ['pacts', 'provider', :provider_name, 'wip'], Api::Resources::WipProviderPacts, {resource_name: "wip_provider_pact_publications"}
45
- end
44
+ # WIP pacts
45
+ add ['pacts', 'provider', :provider_name, 'wip'], Api::Resources::WipProviderPacts, {resource_name: "wip_provider_pact_publications"}
46
46
 
47
47
  # Deprecated pact
48
48
  add ['pact', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publications", deprecated: "true"} # Deprecate, singular /pact
@@ -37,10 +37,10 @@ module PactBroker
37
37
  Line.new(
38
38
  index_item.consumer_name,
39
39
  index_item.consumer_version_number,
40
- index_item.tag_names.join(", "),
40
+ index_item.tag_names.sort.join(", "),
41
41
  index_item.provider_name,
42
42
  index_item.provider_version_number,
43
- index_item.latest_verification_latest_tags.collect(&:name).join(", "),
43
+ index_item.latest_verification_latest_tags.collect(&:name).sort.join(", "),
44
44
  index_item.verification_status.to_s
45
45
  )
46
46
  end
@@ -50,7 +50,7 @@ module PactBroker
50
50
  "#{pactigration_base_url(base_url, pact)}/version/#{pact.consumer_version_number}"
51
51
  end
52
52
 
53
- def pact_version_url pact, base_url
53
+ def pact_version_url pact, base_url = ''
54
54
  "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}"
55
55
  end
56
56
 
@@ -39,9 +39,6 @@ module PactBroker
39
39
  end
40
40
 
41
41
  def finish_request
42
- if update_matrix_after_request?
43
- matrix_service.refresh(identifier_from_path)
44
- end
45
42
  PactBroker.configuration.after_resource.call(self)
46
43
  end
47
44
 
@@ -153,10 +150,6 @@ module PactBroker
153
150
  invalid
154
151
  end
155
152
 
156
- def with_matrix_refresh &block
157
- matrix_service.refresh(identifier_from_path, &block)
158
- end
159
-
160
153
  def find_pacticipant name, role
161
154
  pacticipant_service.find_pacticipant_by_name(name).tap do | pacticipant |
162
155
  set_json_error_message("No #{role} with name '#{name}' found") if pacticipant.nil?
@@ -68,12 +68,6 @@ module PactBroker
68
68
  title: 'All pact versions for the specified provider',
69
69
  templated: true
70
70
  },
71
- 'pb:wip-provider-pacts' =>
72
- {
73
- href: base_url + '/pacts/provider/{provider}/wip',
74
- title: 'WIP pact versions for the specified provider',
75
- templated: true
76
- },
77
71
  'pb:latest-version' => {
78
72
  href: base_url + '/pacticipants/{pacticipant}/latest-version',
79
73
  title: 'Latest pacticipant version',
@@ -89,15 +83,23 @@ module PactBroker
89
83
  title: 'Webhooks',
90
84
  templated: false
91
85
  },
86
+ 'beta:wip-provider-pacts' =>
87
+ {
88
+ href: base_url + '/pacts/provider/{provider}/wip',
89
+ title: 'WIP pact versions for the specified provider',
90
+ templated: true
91
+ },
92
92
  'curies' =>
93
93
  [{
94
94
  name: 'pb',
95
95
  href: base_url + '/doc/{rel}?context=index',
96
96
  templated: true
97
+ },{
98
+ name: 'beta',
99
+ href: base_url + '/doc/{rel}?context=index',
100
+ templated: true
97
101
  }]
98
- }.tap do | it |
99
- it.delete('pb:wip-provider-pacts') if ENV['RACK_ENV'] == 'production'
100
- end
102
+ }
101
103
  end
102
104
  end
103
105
  end
@@ -87,9 +87,7 @@ module PactBroker
87
87
  end
88
88
 
89
89
  def delete_resource
90
- with_matrix_refresh do
91
- pact_service.delete(pact_params)
92
- end
90
+ pact_service.delete(pact_params)
93
91
  true
94
92
  end
95
93
 
@@ -45,9 +45,7 @@ module PactBroker
45
45
  end
46
46
 
47
47
  def delete_resource
48
- with_matrix_refresh do
49
- pacticipant_service.delete pacticipant_name
50
- end
48
+ pacticipant_service.delete pacticipant_name
51
49
  true
52
50
  end
53
51
 
@@ -22,7 +22,6 @@ module PactBroker
22
22
  @tag = tag_service.create identifier_from_path
23
23
  # Make it return a 201 by setting the Location header
24
24
  response.headers["Location"] = tag_url(base_url, tag)
25
- matrix_service.refresh_tags(identifier_from_path)
26
25
  end
27
26
  response.body = to_json
28
27
  end
@@ -40,9 +39,7 @@ module PactBroker
40
39
  end
41
40
 
42
41
  def delete_resource
43
- matrix_service.refresh_tags(identifier_from_path) do
44
- tag_service.delete identifier_from_path
45
- end
42
+ tag_service.delete identifier_from_path
46
43
  true
47
44
  end
48
45
  end
@@ -14,6 +14,8 @@ module PactBroker
14
14
  [["application/hal+json", :to_json], ["application/json", :to_json]]
15
15
  end
16
16
 
17
+ # Remember to update latest_verification_id_for_pact_version_and_provider_version
18
+ # if/when DELETE is implemented
17
19
  def allowed_methods
18
20
  ["GET", "OPTIONS"]
19
21
  end
@@ -25,9 +25,7 @@ module PactBroker
25
25
  end
26
26
 
27
27
  def delete_resource
28
- with_matrix_refresh do
29
- version_service.delete version
30
- end
28
+ version_service.delete version
31
29
  true
32
30
  end
33
31
 
@@ -75,6 +75,14 @@ module PactBroker
75
75
  else
76
76
  logger.info "Skipping database migrations"
77
77
  end
78
+
79
+ if configuration.auto_migrate_db_data
80
+ logger.info "Migrating data"
81
+ PactBroker::DB.run_data_migrations configuration.database_connection
82
+ else
83
+ logger.info "Skipping data migrations"
84
+ end
85
+
78
86
  require 'pact_broker/webhooks/service'
79
87
  PactBroker::Webhooks::Service.fail_retrying_triggered_webhooks
80
88
  end
@@ -6,3 +6,15 @@ module PactBroker
6
6
  Certificate.plugin :timestamps, update_on_create: true
7
7
  end
8
8
  end
9
+
10
+ # Table: certificates
11
+ # Columns:
12
+ # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
13
+ # uuid | text | NOT NULL
14
+ # description | text |
15
+ # content | text | NOT NULL
16
+ # created_at | timestamp without time zone | NOT NULL
17
+ # updated_at | timestamp without time zone | NOT NULL
18
+ # Indexes:
19
+ # certificates_pkey | PRIMARY KEY btree (id)
20
+ # uq_certificate_uuid | UNIQUE btree (uuid)