Skip to content

Commit

Permalink
fix: don't drop column from view in down step, because you can't remo…
Browse files Browse the repository at this point in the history
…ve a column from a view in posgres
  • Loading branch information
bethesque committed Sep 12, 2019
1 parent b0e0d7b commit 045f3f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 64 deletions.
15 changes: 1 addition & 14 deletions db/migrations/20190909_add_test_results_to_all_verifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@
end

down do
create_or_replace_view(:all_verifications,
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),
:build_url,
:pact_version_id,
:execution_date,
Sequel[:verifications][:created_at]
).join(:versions, {id: :provider_version_id}, {:table_alias => :v})
)
# do nothing - you can't drop columns from a postgres view
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,6 @@
end

down do
v = :verifications
create_or_replace_view(:latest_verifications,
from(v)
.select(
Sequel[v][:id],
Sequel[v][:number],
Sequel[v][:success],
Sequel[:s][:number].as(:provider_version),
Sequel[v][:build_url],
Sequel[v][:pact_version_id],
Sequel[v][:execution_date],
Sequel[v][:created_at],
Sequel[v][:provider_version_id],
Sequel[:s][:number].as(:provider_version_number),
Sequel[:s][:order].as(:provider_version_order))
.join(:latest_verification_numbers,
{
Sequel[v][:pact_version_id] => Sequel[:lv][:pact_version_id],
Sequel[v][:number] => Sequel[:lv][:latest_number]
}, { table_alias: :lv })
.join(:versions,
{
Sequel[v][:provider_version_id] => Sequel[:s][:id]
}, { table_alias: :s })
)
# do nothing - you can't drop columns from a postgres view
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@
end

down do
# The most recent verification for each pact_version
v = :verifications
create_or_replace_view(:latest_verifications_for_pact_versions,
from(v)
.select(
Sequel[v][:id],
Sequel[v][:number],
Sequel[v][:success],
Sequel[v][:build_url],
Sequel[v][:pact_version_id],
Sequel[v][:execution_date],
Sequel[v][:created_at],
Sequel[v][:provider_version_id],
Sequel[:s][:number].as(:provider_version_number),
Sequel[:s][:order].as(:provider_version_order))
.join(:latest_verification_ids_for_pact_versions,
{
Sequel[v][:pact_version_id] => Sequel[:lv][:pact_version_id],
Sequel[v][:id] => Sequel[:lv][:latest_verification_id]
}, { table_alias: :lv })
.join(:versions,
{
Sequel[v][:provider_version_id] => Sequel[:s][:id]
}, { table_alias: :s })
)
# do nothing - you can't drop columns from a postgres view
end
end

0 comments on commit 045f3f3

Please sign in to comment.