CREATE TABLE IF NOT EXISTS `loans` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `book_id` INT NOT NULL,
  `user_id` INT NOT NULL,
  `loan_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `due_date` TIMESTAMP NOT NULL,
  `return_date` TIMESTAMP NULL,
  FOREIGN KEY (`book_id`) REFERENCES `books`(`id`),
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`)
);
