-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix error that occurs in some versions of Sqlite when running 20…
…210702_drop_unused_columns_from_deployed_versions.rb Fixes: #521
- Loading branch information
Showing
3 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
def all_verifications_v2(connection) | ||
# Need to fully qualify build_url because versions now has a build_url too. | ||
# We don't use this view any more but we get an error when modifying other tables and views | ||
# if we don't update this, so it must force some re-calculation to be done. | ||
# See https://github.com/pact-foundation/pact_broker/issues/521 | ||
connection | ||
.from(:verifications) | ||
.select( | ||
Sequel[:verifications][:id], | ||
Sequel[:verifications][:number], | ||
:success, | ||
:provider_version_id, | ||
Sequel[:v][:number].as(:provider_version_number), | ||
Sequel[:v][:order].as(:provider_version_order), | ||
Sequel[:verifications][:build_url], | ||
:pact_version_id, | ||
:execution_date, | ||
Sequel[:verifications][:created_at], | ||
:test_results | ||
).join(:versions, { id: :provider_version_id }, { :table_alias => :v }) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require_relative "../ddl_statements/all_verifications" | ||
|
||
# Naughtily insert this migration file after the creation of 20211104_switch_integrations_and_temp_integrations.rb | ||
# to fix the all_verifications view before | ||
# dropping the columns in 20210702_drop_unused_columns_from_deployed_versions.rb. | ||
# The update to all_verifications was already applied in | ||
# 20211101_recreate_all_verifications.rb, but some versions of SQLite error | ||
# if the view is not updated first, meaning 20210702 was never run. | ||
# It won't matter if this update runs out of order, as long as it's after | ||
# 20210117_add_branch_to_version.rb | ||
Sequel.migration do | ||
up do | ||
create_or_replace_view(:all_verifications, all_verifications_v2(self)) | ||
end | ||
|
||
down do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters