1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Data provider simplification, tests, and documentation (#1997)

* Ignore env.test from source control

* Simplification of providers interface

* Synth tests

* Update money to use new find rates method

* Remove unused issues code

* Additional issue feature removals

* Update price data fetching and tests

* Update documentation for providers

* Security test fixes

* Fix self host test

* Update synth usage data access

* Remove AI pr schema changes
This commit is contained in:
Zach Gollwitzer 2025-03-17 11:54:53 -04:00 committed by GitHub
parent dd75cadebc
commit f65b93a352
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 2014 additions and 1638 deletions

View file

@ -0,0 +1,5 @@
class RemoveTickerFromSecurityPrices < ActiveRecord::Migration[7.2]
def change
remove_column :security_prices, :ticker
end
end

View file

@ -0,0 +1,11 @@
class RemoveIssues < ActiveRecord::Migration[7.2]
def change
drop_table :issues do |t|
t.references :issuable, polymorphic: true, null: false
t.string :type, null: false
t.integer :severity, null: false
t.datetime :last_observed_at
t.datetime :resolved_at
end
end
end

View file

@ -0,0 +1,31 @@
class SecurityPriceUniqueIndex < ActiveRecord::Migration[7.2]
def change
# First, we have to delete duplicate prices from DB so we can apply the unique index
reversible do |dir|
dir.up do
execute <<~SQL
DELETE FROM security_prices
WHERE id IN (
SELECT id FROM (
SELECT id,
ROW_NUMBER() OVER (
PARTITION BY security_id, date, currency
ORDER BY updated_at DESC, id DESC
) as row_num
FROM security_prices
) as duplicates
WHERE row_num > 1
);
SQL
end
end
add_index :security_prices, [ :security_id, :date, :currency ], unique: true
change_column_null :security_prices, :date, false
change_column_null :security_prices, :price, false
change_column_null :security_prices, :currency, false
change_column_null :exchange_rates, :date, false
change_column_null :exchange_rates, :rate, false
end
end