-- migrate:up
CREATE TABLE IF NOT EXISTS log_webhook(
    id serial primary key,
    shop_id int not null,
    platform_id int not null,
    order_sn varchar(100),
    request_raw text not null,
    request_data text,
    response_data text,
    type_service varchar(100) not null,
    created_at timestamp,

    CONSTRAINT fk_shop FOREIGN KEY (shop_id) REFERENCES shop(id) ON DELETE RESTRICT,
    CONSTRAINT fk_platform FOREIGN KEY (platform_id) REFERENCES platform(id) ON DELETE RESTRICT
);

CREATE INDEX idx_log_webhook_shop_id ON log_webhook(shop_id);
CREATE INDEX idx_log_webhook_platform_id ON log_webhook(platform_id);

-- migrate:down
DROP TABLE IF EXISTS log_webhook;
