sqldb: make migration 1 and 3 idempotent

This commit is contained in:
Andras Banki-Horvath committed 2025-03-28 11:00:56 +01:00
1 parent b6cf1bcaa0
commit 65b2bac81c
2 files changed
+20 -13

No files matched your search

+4 -2
View File
@@ -1,12 +1,14 @@
-- sequences contains all sequences used for invoices.
CREATE TABLE invoice_sequences (
CREATE TABLE IF NOT EXISTS invoice_sequences (
name TEXT PRIMARY KEY,
current_value BIGINT NOT NULL
);
-- Initialize a sequence for the settled index used to track invoice settlement
-- to remain compatible with the legacy channeldb implementation.
INSERT INTO invoice_sequences(name, current_value) VALUES ('settle_index', 0);
INSERT INTO invoice_sequences (name, current_value)
VALUES ('settle_index', 0)
ON CONFLICT (name) DO NOTHING;
-- invoices table contains all the information shared by all the invoice types.
CREATE TABLE IF NOT EXISTS invoices (