From a6c770462da53169a11633e53b54fe029f9f7278 Mon Sep 17 00:00:00 2001 From: Yaacov Akiba Slama Date: Sun, 16 Aug 2020 12:15:02 +0300 Subject: [PATCH] Add postgresql migration files --- postgresql/migrations/000000_.down.sql | 0 postgresql/migrations/000000_.up.sql | 0 postgresql/migrations/000001_create_paymens_table.up.sql | 5 +++++ postgresql/migrations/000001_create_payments_table.down.sql | 1 + postgresql/migrations/000002_details.down.sql | 5 +++++ postgresql/migrations/000002_details.up.sql | 5 +++++ postgresql/migrations/000003_funding_tx.down.sql | 2 ++ postgresql/migrations/000003_funding_tx.up.sql | 2 ++ 8 files changed, 20 insertions(+) create mode 100644 postgresql/migrations/000000_.down.sql create mode 100644 postgresql/migrations/000000_.up.sql create mode 100644 postgresql/migrations/000001_create_paymens_table.up.sql create mode 100644 postgresql/migrations/000001_create_payments_table.down.sql create mode 100644 postgresql/migrations/000002_details.down.sql create mode 100644 postgresql/migrations/000002_details.up.sql create mode 100644 postgresql/migrations/000003_funding_tx.down.sql create mode 100644 postgresql/migrations/000003_funding_tx.up.sql diff --git a/postgresql/migrations/000000_.down.sql b/postgresql/migrations/000000_.down.sql new file mode 100644 index 0000000..e69de29 diff --git a/postgresql/migrations/000000_.up.sql b/postgresql/migrations/000000_.up.sql new file mode 100644 index 0000000..e69de29 diff --git a/postgresql/migrations/000001_create_paymens_table.up.sql b/postgresql/migrations/000001_create_paymens_table.up.sql new file mode 100644 index 0000000..19cbdeb --- /dev/null +++ b/postgresql/migrations/000001_create_paymens_table.up.sql @@ -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) +); \ No newline at end of file diff --git a/postgresql/migrations/000001_create_payments_table.down.sql b/postgresql/migrations/000001_create_payments_table.down.sql new file mode 100644 index 0000000..8baef0d --- /dev/null +++ b/postgresql/migrations/000001_create_payments_table.down.sql @@ -0,0 +1 @@ +DROP TABLE public.payments; \ No newline at end of file diff --git a/postgresql/migrations/000002_details.down.sql b/postgresql/migrations/000002_details.down.sql new file mode 100644 index 0000000..b559ed4 --- /dev/null +++ b/postgresql/migrations/000002_details.down.sql @@ -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; \ No newline at end of file diff --git a/postgresql/migrations/000002_details.up.sql b/postgresql/migrations/000002_details.up.sql new file mode 100644 index 0000000..68d95fa --- /dev/null +++ b/postgresql/migrations/000002_details.up.sql @@ -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; \ No newline at end of file diff --git a/postgresql/migrations/000003_funding_tx.down.sql b/postgresql/migrations/000003_funding_tx.down.sql new file mode 100644 index 0000000..c6da088 --- /dev/null +++ b/postgresql/migrations/000003_funding_tx.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.payments DROP COLUMN funding_tx_id; +ALTER TABLE public.payments DROP COLUMN funding_tx_outnum; \ No newline at end of file diff --git a/postgresql/migrations/000003_funding_tx.up.sql b/postgresql/migrations/000003_funding_tx.up.sql new file mode 100644 index 0000000..df40ee6 --- /dev/null +++ b/postgresql/migrations/000003_funding_tx.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.payments ADD funding_tx_id bytea NULL; +ALTER TABLE public.payments ADD funding_tx_outnum int NULL; \ No newline at end of file