38471-vm/db/migrations/20260218_pos_payments.sql
2026-02-18 12:01:04 +00:00

13 lines
590 B
SQL

-- Create pos_payments table to support split payments and detailed reporting
CREATE TABLE IF NOT EXISTS pos_payments (
id INT AUTO_INCREMENT PRIMARY KEY,
transaction_id INT NOT NULL,
payment_method VARCHAR(50) NOT NULL,
amount DECIMAL(15, 3) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (transaction_id) REFERENCES pos_transactions(id) ON DELETE CASCADE
);
-- Add register_session_id to pos_transactions if missing (already exists but for idempotency)
-- ALTER TABLE pos_transactions ADD COLUMN IF NOT EXISTS register_session_id INT NULL;