Files
sure/db/migrate/20251031132654_create_recurring_transactions.rb
soky srm e290e3d4a1 Recurring transactions (#271)
* Implement recurring transactions support

* Amount fix

* Hide section when any filter is applied

* Add automatic identify feature

Automatic identification runs after:
  - CSV Import completes (TransactionImport, TradeImport, AccountImport, MintImport)
  - Plaid sync completes
  - SimpleFIN sync completes
  - LunchFlow sync completes
- Any new provider that we create.

* Fix linter and tests

* Fix address review

* FIX proper text sizing

* Fix further linter

Use circular distance to handle month-boundary wrapping

* normalize to a circular representation before computing the median

* Better tests validation

* Added some UI info

Fix pattern identification, last recurrent transaction needs to happened within the last 45 days.

* Fix styling

* Revert text subdued look

* Match structure of the other sections

* Styling

* Restore positive amounts styling

* Shorten label for UI styling

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-01 09:12:42 +01:00

24 lines
997 B
Ruby

class CreateRecurringTransactions < ActiveRecord::Migration[7.2]
def change
create_table :recurring_transactions, id: :uuid do |t|
t.references :family, null: false, foreign_key: true, type: :uuid
t.references :merchant, null: false, foreign_key: true, type: :uuid
t.decimal :amount, precision: 19, scale: 4, null: false
t.string :currency, null: false
t.integer :expected_day_of_month, null: false
t.date :last_occurrence_date, null: false
t.date :next_expected_date, null: false
t.string :status, default: "active", null: false
t.integer :occurrence_count, default: 0, null: false
t.timestamps
end
add_index :recurring_transactions, [ :family_id, :merchant_id, :amount, :currency ],
unique: true,
name: "idx_recurring_txns_on_family_merchant_amount_currency"
add_index :recurring_transactions, [ :family_id, :status ]
add_index :recurring_transactions, :next_expected_date
end
end