Skip to content

Commit d01848c

Browse files
committed
loopdb: store reservation prepay invoice
1 parent 82bfaa0 commit d01848c

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

instantout/reservation/store.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func (r *SQLStore) CreateReservation(ctx context.Context,
8484
ClientKeyIndex: int32(reservation.KeyLocator.Index),
8585
InitiationHeight: reservation.InitiationHeight,
8686
ProtocolVersion: int32(reservation.ProtocolVersion),
87+
PrepayInvoice: reservation.PrepayInvoice,
8788
}
8889

8990
updateArgs := sqlc.InsertReservationUpdateParams{
@@ -289,6 +290,7 @@ func sqlReservationToReservation(row sqlc.Reservation,
289290
InitiationHeight: row.InitiationHeight,
290291
State: fsm.StateType(lastUpdate.UpdateState),
291292
ProtocolVersion: ProtocolVersion(row.ProtocolVersion),
293+
PrepayInvoice: row.PrepayInvoice,
292294
}, nil
293295
}
294296

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE reservations DROP COLUMN prepay_invoice;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- prepay_invoice is a field that will store the invoice of the prepay payment
2+
-- that pays for the reservation.
3+
ALTER TABLE reservations ADD COLUMN prepay_invoice TEXT NOT NULL DEFAULT '';

loopdb/sqlc/models.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

loopdb/sqlc/queries/reservations.sql

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ INSERT INTO reservations (
88
client_key_family,
99
client_key_index,
1010
initiation_height,
11-
protocol_version
11+
protocol_version,
12+
prepay_invoice
1213
) VALUES (
1314
$1,
1415
$2,
@@ -18,7 +19,8 @@ INSERT INTO reservations (
1819
$6,
1920
$7,
2021
$8,
21-
$9
22+
$9,
23+
$10
2224
);
2325

2426
-- name: UpdateReservation :exec

loopdb/sqlc/reservations.sql.go

+10-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)