Skip to content

Commit

Permalink
Drop migrations using SampleTransfer
Browse files Browse the repository at this point in the history
These data migrations are unnecessary and conflict with the removal of
the `SampleTransfer` model.
  • Loading branch information
straight-shoota authored and diegoliberman committed Jun 16, 2022
1 parent 60df673 commit 6b79696
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
class ChangeSampleTransfersRequiresTransferPackage < ActiveRecord::Migration
def up
# Create packages for existing transfers
SampleTransfer.where(transfer_package_id: nil).find_each do |transfer|
package = TransferPackage.create(
sender_institution_id: transfer.sender_institution_id,
receiver_institution_id: transfer.receiver_institution_id,
)
transfer.update_columns(
transfer_package_id: package.id,
)
end

change_column_null :sample_transfers, :transfer_package_id, false
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ def up
add_index :transfer_packages, :confirmed_at

TransferPackage.reset_column_information

# Fill confirmed_at on existing packages if their sample transfers have been confirmed
TransferPackage.find_each do |package|
if confirmed_at = package.sample_transfers.map(&:confirmed_at).compact.max
package.update_columns(
confirmed_at: confirmed_at,
)
end
end
end

def down
Expand Down

0 comments on commit 6b79696

Please sign in to comment.