1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Fix import migration (#1227)

This commit is contained in:
Zach Gollwitzer 2024-10-01 18:59:35 -04:00 committed by GitHub
parent b1d2dc5e97
commit cb75c537fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,7 @@
class AddImportTypes < ActiveRecord::Migration[7.2] class AddImportTypes < ActiveRecord::Migration[7.2]
def change def change
change_table :imports do |t| change_table :imports do |t|
t.string :type, null: false t.string :type
t.string :date_col_label, default: "date" t.string :date_col_label, default: "date"
t.string :amount_col_label, default: "amount" t.string :amount_col_label, default: "amount"
t.string :name_col_label, default: "name" t.string :name_col_label, default: "name"
@ -19,6 +19,10 @@ class AddImportTypes < ActiveRecord::Migration[7.2]
t.string :error t.string :error
end end
Import.update_all(type: "TransactionImport")
change_column_null :imports, :type, false
# Add import references so we can associate imported resources after the import # Add import references so we can associate imported resources after the import
add_reference :account_entries, :import, foreign_key: true, type: :uuid add_reference :account_entries, :import, foreign_key: true, type: :uuid
add_reference :accounts, :import, foreign_key: true, type: :uuid add_reference :accounts, :import, foreign_key: true, type: :uuid