diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backenddb/merchant-0004.sql | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/backenddb/merchant-0004.sql b/src/backenddb/merchant-0004.sql index 43138c22..26440816 100644 --- a/src/backenddb/merchant-0004.sql +++ b/src/backenddb/merchant-0004.sql @@ -47,8 +47,6 @@ COMMENT ON COLUMN merchant_template.image COMMENT ON COLUMN merchant_template.template_contract IS 'The template contract will contains some additional information.'; -COMMIT; - CREATE TABLE IF NOT EXISTS merchant_webhook (webhook_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY @@ -67,12 +65,44 @@ COMMENT ON TABLE merchant_webhook COMMENT ON COLUMN merchant_webhook.event_type IS 'Event of the webhook'; COMMENT ON COLUMN merchant_webhook.url - IS 'URL use by the customer'; + IS 'URL to make the request to'; COMMENT ON COLUMN merchant_webhook.http_method IS 'http method use by the merchant'; COMMENT ON COLUMN merchant_webhook.header_template - IS 'Header of the webhook'; + IS 'Template for the header of the webhook, to be modified based on trigger data'; COMMENT ON COLUMN merchant_webhook.body_template + IS 'Template for the body of the webhook, to be modified based on trigger data'; + + +CREATE TABLE IF NOT EXISTS merchant_pending_webhooks + (webhook_pending_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY + ,merchant_serial BIGINT NOT NULL + REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE + ,webhook_serial BIGINT NOT NULL + REFERENCES merchant_webhook (webhook_serial) ON DELETE CASCADE + ,retries INT4 NOT NULL DEFAULT(0) + ,next_attempt INT8 NOT NULL DEFAULT(0) + ,url VARCHAR NOT NULL + ,http_method VARCHAR NOT NULL + ,header VARCHAR + ,body VARCHAR + ,UNIQUE (merchant_serial, webhook_pending_serial) + ); +COMMENT ON TABLE merchant_pending_webhooks + IS 'webhooks that still need to be executed by the merchant'; +COMMENT ON COLUMN merchant_pending_webhooks.url + IS 'URL to make the request to'; +COMMENT ON COLUMN merchant_pending_webhooks.webhook_id + IS 'Reference to the configured webhook template'; +COMMENT ON COLUMN merchant_pending_webhooks.retries + IS 'How often have we tried this request so far'; +COMMENT ON COLUMN merchant_pending_webhooks.next_attempt + IS 'Time when we should make the next request to the webhook'; +COMMENT ON COLUMN merchant_pending_webhooks.http_method + IS 'http method use for the webhook'; +COMMENT ON COLUMN merchant_pending_webhooks.header_template + IS 'Header of the webhook'; +COMMENT ON COLUMN merchant_pending_webhooks.body_template IS 'Body of the webhook'; COMMIT; |