CREATE TABLE escrow_transactions ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255), buyer_id INT, seller_id INT, amount DECIMAL(10,2), status ENUM('awaiting_payment', 'funded', 'delivered', 'confirmed', 'disputed', 'closed') DEFAULT 'awaiting_payment', description TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (buyer_id) REFERENCES users(id), FOREIGN KEY (seller_id) REFERENCES users(id) ); CREATE TABLE escrow_payments ( id INT AUTO_INCREMENT PRIMARY KEY, transaction_id INT, method ENUM('momo', 'card') DEFAULT 'momo', reference VARCHAR(100), amount DECIMAL(10,2), status ENUM('pending', 'success', 'failed'), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (transaction_id) REFERENCES escrow_transactions(id) ); CREATE TABLE escrow_actions ( id INT AUTO_INCREMENT PRIMARY KEY, transaction_id INT, actor_id INT, action TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (transaction_id) REFERENCES escrow_transactions(id), FOREIGN KEY (actor_id) REFERENCES users(id) );