mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-06 21:49:12 +02:00
sqldb: ensure schema definitions are fully SQLite compatible
Previously, we applied replacements to our schema definitions to make them compatible with both SQLite and Postgres backends, as the files were not fully compatible with either. With this change, the only replacement required for SQLite has been moved to the generator script. This adjustment ensures compatibility by enabling auto-incrementing primary keys that are treated as 64-bit integers by sqlc.
This commit is contained in:
@ -591,7 +591,7 @@ INSERT INTO invoice_payment_hashes (
|
||||
`
|
||||
|
||||
type InsertKVInvoiceKeyAndAddIndexParams struct {
|
||||
ID int32
|
||||
ID int64
|
||||
AddIndex int64
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ WHERE id = $1
|
||||
`
|
||||
|
||||
type SetKVInvoicePaymentHashParams struct {
|
||||
ID int32
|
||||
ID int64
|
||||
Hash []byte
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ INSERT INTO invoice_sequences(name, current_value) VALUES ('settle_index', 0);
|
||||
-- invoices table contains all the information shared by all the invoice types.
|
||||
CREATE TABLE IF NOT EXISTS invoices (
|
||||
-- The id of the invoice. Translates to the AddIndex.
|
||||
id BIGINT PRIMARY KEY,
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
-- The hash for this invoice. The invoice hash will always identify that
|
||||
-- invoice.
|
||||
@ -102,8 +102,8 @@ CREATE INDEX IF NOT EXISTS invoice_feature_invoice_id_idx ON invoice_features(in
|
||||
CREATE TABLE IF NOT EXISTS invoice_htlcs (
|
||||
-- The id for this htlc. Used in foreign keys instead of the
|
||||
-- htlc_id/chan_id combination.
|
||||
id BIGINT PRIMARY KEY,
|
||||
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
-- Short chan id indicating the htlc's origin. uint64 stored as text.
|
||||
chan_id TEXT NOT NULL,
|
||||
|
||||
@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS invoice_htlcs (
|
||||
-- int64 in the database. The application layer must check that there is no
|
||||
-- overflow when storing/loading this column.
|
||||
htlc_id BIGINT NOT NULL,
|
||||
|
||||
|
||||
-- The htlc's amount in millisatoshis.
|
||||
amount_msat BIGINT NOT NULL,
|
||||
|
||||
|
@ -29,7 +29,7 @@ VALUES
|
||||
-- AMP sub invoices. This table can be used to create a historical view of what
|
||||
-- happened to the node's invoices.
|
||||
CREATE TABLE IF NOT EXISTS invoice_events (
|
||||
id BIGINT PRIMARY KEY,
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
-- added_at is the timestamp when this event was added.
|
||||
added_at TIMESTAMP NOT NULL,
|
||||
|
@ -58,7 +58,7 @@ type InvoiceEvent struct {
|
||||
}
|
||||
|
||||
type InvoiceEventType struct {
|
||||
ID int32
|
||||
ID int64
|
||||
Description string
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ type InvoiceHtlcCustomRecord struct {
|
||||
}
|
||||
|
||||
type InvoicePaymentHash struct {
|
||||
ID int32
|
||||
ID int64
|
||||
AddIndex int64
|
||||
Hash []byte
|
||||
}
|
||||
|
Reference in New Issue
Block a user