mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-22 00:04:26 +01:00
automation
This commit is contained in:
0
postgresql/migrations/000000_.down.sql
Normal file
0
postgresql/migrations/000000_.down.sql
Normal file
0
postgresql/migrations/000000_.up.sql
Normal file
0
postgresql/migrations/000000_.up.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE public.payments;
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE public.payments (
|
||||
payment_hash bytea NOT NULL,
|
||||
payment_request_out varchar NOT NULL,
|
||||
CONSTRAINT payments_pkey PRIMARY KEY (payment_hash)
|
||||
);
|
||||
5
postgresql/migrations/000002_details.down.sql
Normal file
5
postgresql/migrations/000002_details.down.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE public.payments DROP COLUMN payment_secret;
|
||||
ALTER TABLE public.payments DROP COLUMN destination;
|
||||
ALTER TABLE public.payments DROP COLUMN incoming_amount_msat;
|
||||
ALTER TABLE public.payments DROP COLUMN outgoing_amount_msat;
|
||||
ALTER TABLE public.payments ADD payment_request_out varchar NOT NULL;
|
||||
5
postgresql/migrations/000002_details.up.sql
Normal file
5
postgresql/migrations/000002_details.up.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE public.payments DROP COLUMN payment_request_out;
|
||||
ALTER TABLE public.payments ADD payment_secret bytea NOT NULL;
|
||||
ALTER TABLE public.payments ADD destination bytea NOT NULL;
|
||||
ALTER TABLE public.payments ADD incoming_amount_msat bigint NOT NULL;
|
||||
ALTER TABLE public.payments ADD outgoing_amount_msat bigint NOT NULL;
|
||||
2
postgresql/migrations/000003_funding_tx.down.sql
Normal file
2
postgresql/migrations/000003_funding_tx.down.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE public.payments DROP COLUMN funding_tx_id;
|
||||
ALTER TABLE public.payments DROP COLUMN funding_tx_outnum;
|
||||
2
postgresql/migrations/000003_funding_tx.up.sql
Normal file
2
postgresql/migrations/000003_funding_tx.up.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE public.payments ADD funding_tx_id bytea NULL;
|
||||
ALTER TABLE public.payments ADD funding_tx_outnum int NULL;
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX probe_payment_hash;
|
||||
@@ -0,0 +1 @@
|
||||
CREATE INDEX probe_payment_hash ON public.payments (sha256('probing-01:' || payment_hash));
|
||||
1
postgresql/migrations/000005_forwarding_history.down.sql
Normal file
1
postgresql/migrations/000005_forwarding_history.down.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE public.forwarding_history;
|
||||
10
postgresql/migrations/000005_forwarding_history.up.sql
Normal file
10
postgresql/migrations/000005_forwarding_history.up.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE public.forwarding_history (
|
||||
"timestamp" bigint NOT NULL,
|
||||
chanid_in bigint NOT NULL,
|
||||
chanid_out bigint NOT NULL,
|
||||
amt_msat_in bigint NOT NULL,
|
||||
amt_msat_out bigint NOT NULL,
|
||||
CONSTRAINT timestamp_pkey PRIMARY KEY ("timestamp")
|
||||
);
|
||||
CREATE INDEX forwarding_history_chanid_in_idx ON public.forwarding_history (chanid_in);
|
||||
CREATE INDEX forwarding_history_chanid_out_idx ON public.forwarding_history (chanid_out);
|
||||
1
postgresql/migrations/000006_channels.down.sql
Normal file
1
postgresql/migrations/000006_channels.down.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE public.channels;
|
||||
7
postgresql/migrations/000006_channels.up.sql
Normal file
7
postgresql/migrations/000006_channels.up.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE public.channels (
|
||||
chanid bigint NOT NULL,
|
||||
channel_point varchar NULL,
|
||||
nodeid bytea NULL,
|
||||
CONSTRAINT chanid_pkey PRIMARY KEY (chanid)
|
||||
);
|
||||
CREATE INDEX channels_nodeid_idx ON public.channels (nodeid);
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.channels DROP COLUMN last_update;
|
||||
1
postgresql/migrations/000007_channels_last_update.up.sql
Normal file
1
postgresql/migrations/000007_channels_last_update.up.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.channels ADD COLUMN last_update TIMESTAMP;
|
||||
21
postgresql/migrations/000008_one_record_per_channel.down.sql
Normal file
21
postgresql/migrations/000008_one_record_per_channel.down.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
ALTER INDEX public.channels_nodeid_idx RENAME TO channels_new_nodeid_idx;
|
||||
ALTER INDEX public.channels_channel_point_pkey RENAME TO channels_new_channel_point_pkey
|
||||
ALTER TABLE public.channels RENAME TO channels_new;
|
||||
|
||||
CREATE TABLE public.channels (
|
||||
chanid int8 NOT NULL,
|
||||
channel_point varchar NULL,
|
||||
nodeid bytea NULL,
|
||||
last_update timestamp NULL,
|
||||
CONSTRAINT chanid_pkey PRIMARY KEY (chanid)
|
||||
);
|
||||
CREATE INDEX channels_nodeid_idx ON public.channels USING btree (nodeid);
|
||||
|
||||
INSERT INTO public.channels
|
||||
SELECT initial_chanid chanid, channel_point, nodeid, last_update FROM channels_new;
|
||||
|
||||
INSERT INTO public.channels
|
||||
SELECT confirmed_chanid chanid, channel_point, nodeid, last_update FROM channels_new
|
||||
WHERE confirmed_chanid IS NOT NULL AND confirmed_chanid <> initial_chanid;
|
||||
|
||||
DROP TABLE channels_new;
|
||||
22
postgresql/migrations/000008_one_record_per_channel.up.sql
Normal file
22
postgresql/migrations/000008_one_record_per_channel.up.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
ALTER INDEX public.channels_nodeid_idx RENAME TO channels_old_nodeid_idx;
|
||||
ALTER INDEX public.chanid_pkey RENAME TO channels_old_chanid_pkey;
|
||||
ALTER TABLE public.channels RENAME TO channels_old;
|
||||
|
||||
CREATE TABLE public.channels (
|
||||
initial_chanid int8 NOT NULL,
|
||||
confirmed_chanid int8 NULL,
|
||||
channel_point varchar NOT NULL,
|
||||
nodeid bytea NOT NULL,
|
||||
last_update timestamp NULL,
|
||||
CONSTRAINT channels_channel_point_pkey PRIMARY KEY (channel_point)
|
||||
);
|
||||
CREATE INDEX channels_nodeid_idx ON public.channels USING btree (nodeid);
|
||||
|
||||
INSERT INTO public.channels
|
||||
SELECT
|
||||
min(chanid) initial_chanid,
|
||||
CASE WHEN (max(chanid) >> 40) < (3 << 17) THEN NULL ELSE max(chanid) END confirmed_chanid,
|
||||
channel_point, nodeid, max(last_update) last_update
|
||||
FROM channels_old GROUP BY channel_point, nodeid;
|
||||
|
||||
DROP TABLE public.channels_old;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.payments DROP COLUMN tag;
|
||||
1
postgresql/migrations/000009_register_payment_tag.up.sql
Normal file
1
postgresql/migrations/000009_register_payment_tag.up.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.payments ADD tag jsonb NULL;
|
||||
1
postgresql/migrations/000010_opening_fee_params.down.sql
Normal file
1
postgresql/migrations/000010_opening_fee_params.down.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.payments DROP COLUMN opening_fee_params;
|
||||
1
postgresql/migrations/000010_opening_fee_params.up.sql
Normal file
1
postgresql/migrations/000010_opening_fee_params.up.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE public.payments ADD opening_fee_params jsonb NULL;
|
||||
1
postgresql/migrations/000011_new_channel_params.down.sql
Normal file
1
postgresql/migrations/000011_new_channel_params.down.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE public.new_channel_params;
|
||||
11
postgresql/migrations/000011_new_channel_params.up.sql
Normal file
11
postgresql/migrations/000011_new_channel_params.up.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE public.new_channel_params (
|
||||
validity int NOT NULL,
|
||||
params jsonb NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX new_channel_params_validity_idx ON public.new_channel_params (validity);
|
||||
|
||||
INSERT INTO public.new_channel_params (validity, params)
|
||||
VALUES(259200, '{"min_msat": "12000000", "proportional": 7500, "max_idle_time": 4320, "max_client_to_self_delay": 432}'::jsonb);
|
||||
|
||||
INSERT INTO public.new_channel_params (validity, params)
|
||||
VALUES(3600, '{"min_msat": "10000000", "proportional": 7500, "max_idle_time": 4320, "max_client_to_self_delay": 432}'::jsonb);
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE public.new_channel_params DROP COLUMN token;
|
||||
DROP INDEX new_channel_params_token_validity_idx;
|
||||
CREATE UNIQUE INDEX new_channel_params_validity_idx ON public.new_channel_params (validity);
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE public.new_channel_params ADD token varchar;
|
||||
DROP INDEX public.new_channel_params_validity_idx;
|
||||
CREATE UNIQUE INDEX new_channel_params_token_validity_idx ON public.new_channel_params (token, validity);
|
||||
@@ -0,0 +1,3 @@
|
||||
DROP INDEX notification_subscriptions_pubkey_url_key;
|
||||
DROP INDEX notification_subscriptions_pubkey_idx;
|
||||
DROP TABLE public.notification_subscriptions;
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE public.notification_subscriptions (
|
||||
id bigserial primary key,
|
||||
pubkey bytea NOT NULL,
|
||||
url varchar NOT NULL,
|
||||
created_at bigint NOT NULL,
|
||||
refreshed_at bigint NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX notification_subscriptions_pubkey_idx ON public.notification_subscriptions (pubkey);
|
||||
CREATE UNIQUE INDEX notification_subscriptions_pubkey_url_key ON public.notification_subscriptions (pubkey, url);
|
||||
Reference in New Issue
Block a user