feat: order action per status change

This commit is contained in:
2026-04-16 14:19:27 +02:00
parent 7bce04e05a
commit 16f92e53ff
33 changed files with 748 additions and 61 deletions

View File

@@ -457,6 +457,30 @@ END$$
DELIMITER ;
CREATE TABLE b2b_order_status_history (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
order_id BIGINT UNSIGNED NOT NULL,
old_status VARCHAR(50) NULL,
new_status VARCHAR(50) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
user_id BIGINT UNSIGNED NULL
);
CREATE INDEX idx_order_status_history_order
ON b2b_order_status_history(order_id);
CREATE INDEX idx_order_status_history_user
ON b2b_order_status_history(user_id);
ALTER TABLE b2b_order_status_history
ADD CONSTRAINT fk_order
FOREIGN KEY (order_id) REFERENCES b2b_customer_orders(order_id);
ALTER TABLE b2b_order_status_history
ADD CONSTRAINT fk_user
FOREIGN KEY (user_id) REFERENCES b2b_customers(id);
-- +goose Down
DROP TABLE IF EXISTS b2b_addresses;