1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/db/migrate/20241029125406_add_reference_to_security_prices.rb
Josh Pigford 490f44589e
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
First pass at security price reference (#1388)
* First pass at security price reference

* Data cleanup

* Synth security fetching does better with a mic_code

* Update test suite

😭

* Update schema.rb

* Update generator.rb
2024-10-29 15:37:59 -04:00

14 lines
392 B
Ruby

class AddReferenceToSecurityPrices < ActiveRecord::Migration[7.2]
def change
add_reference :security_prices, :security, foreign_key: true, type: :uuid
reversible do |dir|
dir.up do
Security::Price.find_each do |sp|
security = Security.find_by(ticker: sp.ticker)
sp.update_column(:security_id, security&.id)
end
end
end
end
end