-- Migration to create the client_credit_log table CREATE TABLE IF NOT EXISTS `client_credit_log` ( `id` INT AUTO_INCREMENT PRIMARY KEY, `client_id` INT NOT NULL, `amount` DECIMAL(10, 2) NOT NULL, `transaction_type` VARCHAR(50) NOT NULL DEFAULT 'payment', `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `notes` TEXT, FOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;