Skip to content

Commit

Permalink
fix: enable data migration
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Jan 18, 2024
1 parent c60461b commit 12cbcec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions db/migrations/20231229091800_add_service_fee.up.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alter table invoices ALTER COLUMN fee SET DEFAULT 0;
alter table invoices ADD COLUMN IF NOT EXISTS service_fee bigint default 0;
alter table invoices ADD COLUMN IF NOT EXISTS routing_fee bigint default 0;

-- maybe manually migrate existing data?
-- alter table invoices ALTER COLUMN fee SET DEFAULT 0;
-- update invoices set fee = 0 where fee IS NULL;
-- update invoices set routing_fee = fee where routing_fee=0;
-- migrate existing data
update invoices set fee = 0 where fee IS NULL;
update invoices set routing_fee = fee where fee > 0;

0 comments on commit 12cbcec

Please sign in to comment.