Skip to content

Commit

Permalink
chore: migrate internal and keysend columns to be non null
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Oct 30, 2023
1 parent 5880dfe commit afaf6fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions db/migrations/20231030140000_invoice_internal.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE invoices
SET internal = false
WHERE internal IS NULL;

ALTER TABLE invoices
ALTER COLUMN internal SET NOT NULL;
6 changes: 6 additions & 0 deletions db/migrations/20231030140000_invoice_keysend.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE invoices
SET keysend = false
WHERE keysend IS NULL;

ALTER TABLE invoices
ALTER COLUMN keysend SET NOT NULL;
4 changes: 2 additions & 2 deletions db/models/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type Invoice struct {
DestinationCustomRecords map[uint64][]byte `json:"custom_records,omitempty"`
RHash string `json:"r_hash"`
Preimage string `json:"preimage" bun:",nullzero"`
Internal bool `json:"-" bun:",nullzero"`
Keysend bool `json:"keysend" bun:",nullzero"`
Internal bool `json:"-" bun:",notnull"`
Keysend bool `json:"keysend" bun:",notnull"`
State string `json:"state" bun:",default:'initialized'"`
ErrorMessage string `json:"error_message,omitempty" bun:",nullzero"`
AddIndex uint64 `json:"-" bun:",nullzero"`
Expand Down

0 comments on commit afaf6fd

Please sign in to comment.