sqldb: add table to track custom SQL migrations

This commit adds the migration_tracker table which we'll use to track if
a custom migration has already been done.
This commit is contained in:
Andras Banki-Horvath
2024-11-12 16:25:29 +01:00
parent 680394518f
commit 9acd06d296
6 changed files with 108 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ package sqlc
import (
"context"
"database/sql"
"time"
)
type Querier interface {
@@ -17,6 +18,7 @@ type Querier interface {
FetchSettledAMPSubInvoices(ctx context.Context, arg FetchSettledAMPSubInvoicesParams) ([]FetchSettledAMPSubInvoicesRow, error)
FilterInvoices(ctx context.Context, arg FilterInvoicesParams) ([]Invoice, error)
GetAMPInvoiceID(ctx context.Context, setID []byte) (int64, error)
GetDatabaseVersion(ctx context.Context) (int32, error)
// This method may return more than one invoice if filter using multiple fields
// from different invoices. It is the caller's responsibility to ensure that
// we bubble up an error in those cases.
@@ -25,6 +27,7 @@ type Querier interface {
GetInvoiceFeatures(ctx context.Context, invoiceID int64) ([]InvoiceFeature, error)
GetInvoiceHTLCCustomRecords(ctx context.Context, invoiceID int64) ([]GetInvoiceHTLCCustomRecordsRow, error)
GetInvoiceHTLCs(ctx context.Context, invoiceID int64) ([]InvoiceHtlc, error)
GetMigration(ctx context.Context, version int32) (time.Time, error)
InsertAMPSubInvoiceHTLC(ctx context.Context, arg InsertAMPSubInvoiceHTLCParams) error
InsertInvoice(ctx context.Context, arg InsertInvoiceParams) (int64, error)
InsertInvoiceFeature(ctx context.Context, arg InsertInvoiceFeatureParams) error
@@ -37,6 +40,7 @@ type Querier interface {
OnInvoiceCanceled(ctx context.Context, arg OnInvoiceCanceledParams) error
OnInvoiceCreated(ctx context.Context, arg OnInvoiceCreatedParams) error
OnInvoiceSettled(ctx context.Context, arg OnInvoiceSettledParams) error
SetMigration(ctx context.Context, arg SetMigrationParams) error
UpdateAMPSubInvoiceHTLCPreimage(ctx context.Context, arg UpdateAMPSubInvoiceHTLCPreimageParams) (sql.Result, error)
UpdateAMPSubInvoiceState(ctx context.Context, arg UpdateAMPSubInvoiceStateParams) error
UpdateInvoiceAmountPaid(ctx context.Context, arg UpdateInvoiceAmountPaidParams) (sql.Result, error)