From 30dd173e7f7d9b4f42ad1386d630dbc9084284a4 Mon Sep 17 00:00:00 2001 From: Fredrik Ringqvist <35255659+fredrikphotowall@users.noreply.github.com> Date: Tue, 12 Apr 2022 09:42:19 +0200 Subject: [PATCH] Inquiry fee (#256) --- migrations/000.366.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 migrations/000.366.sql diff --git a/migrations/000.366.sql b/migrations/000.366.sql new file mode 100644 index 0000000..adc27da --- /dev/null +++ b/migrations/000.366.sql @@ -0,0 +1,12 @@ +ALTER TYPE order_row_sub_type ADD VALUE 'inquiry_fee'; +ALTER TYPE order_row_sub_type ADD VALUE 'pre_paid_inquiry_fee'; + +ALTER TYPE order_row_type ADD VALUE 'payment'; + +alter table inquiries add column pre_payment_order_row_id INT REFERENCES order_rows(id) DEFAULT NULL; +alter table inquiries add column repaid_order_id INT REFERENCES orders(id) DEFAULT NULL; + +-- Add foreign key to original inquiry. +-- ON DELETE SET NULL so we can delete an inquiry (gdpr or otherwise) without getting a foreign key violation +ALTER TABLE inquiries ADD COLUMN duplicate_of INTEGER REFERENCES inquiries(inquiryid) ON DELETE SET NULL; +