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

Feature: Add the ability to "revert" a CSV import (#1814)
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled

* Allow reverting imports

* Fix tests

* Add currency column to all imports

* Don't auto-enrich demo account
This commit is contained in:
Zach Gollwitzer 2025-02-07 15:36:05 -05:00 committed by GitHub
parent 60925bd16c
commit 536c82f2aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 125 additions and 6 deletions

View file

@ -0,0 +1,21 @@
class RemoveImportStatusEnum < ActiveRecord::Migration[7.2]
def up
change_column_default :imports, :status, nil
change_column :imports, :status, :string
execute "DROP TYPE IF EXISTS import_status"
end
def down
execute <<-SQL
CREATE TYPE import_status AS ENUM (
'pending',
'importing',
'complete',
'failed'
);
SQL
change_column :imports, :status, :import_status, using: 'status::import_status'
change_column_default :imports, :status, 'pending'
end
end

3
db/schema.rb generated
View file

@ -18,7 +18,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_02_06_204404) do
# Custom types defined in this database.
# Note that some types may not work with other database engines. Be careful if changing database.
create_enum "account_status", ["ok", "syncing", "error"]
create_enum "import_status", ["pending", "importing", "complete", "failed"]
create_table "account_balances", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "account_id", null: false
@ -391,7 +390,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_02_06_204404) do
create_table "imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.jsonb "column_mappings"
t.enum "status", default: "pending", enum_type: "import_status"
t.string "status"
t.string "raw_file_str"
t.string "normalized_csv_str"
t.datetime "created_at", null: false