-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.8.0.6908
-- --------------------------------------------------------



-- Dumping database structure for hotel_booking
DROP DATABASE IF EXISTS `hotel_booking`;
CREATE DATABASE IF NOT EXISTS `hotel_booking` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `hotel_booking`;

-- Dumping structure for table hotel_booking.bookings
CREATE TABLE IF NOT EXISTS `bookings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `room_id` int NOT NULL,
  `booked_at` datetime NOT NULL DEFAULT (now()),
  `check_in_date` date DEFAULT NULL,
  `check_out_date` date DEFAULT NULL,
  `status` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_user_id` (`user_id`),
  KEY `fk_room_id` (`room_id`),
  CONSTRAINT `fk_room_id` FOREIGN KEY (`room_id`) REFERENCES `rooms` (`id`),
  CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table hotel_booking.bookings: ~9 rows (approximately)
DELETE FROM `bookings`;
INSERT INTO `bookings` (`id`, `user_id`, `room_id`, `booked_at`, `check_in_date`, `check_out_date`, `status`) VALUES
	(1, 2, 2, '2026-01-09 20:18:48', '2026-01-09', '2026-01-10', 'confirmed'),
	(2, 2, 3, '2026-01-09 20:18:57', '2026-01-09', '2026-01-10', 'confirmed'),
	(3, 2, 1, '2026-01-09 20:21:48', '2026-01-09', '2026-01-10', 'confirmed'),
	(4, 2, 2, '2026-01-09 20:21:50', '2026-01-09', '2026-01-10', 'confirmed'),
	(5, 2, 3, '2026-01-09 20:21:51', '2026-01-09', '2026-01-10', 'confirmed'),
	(6, 1, 1, '2026-01-09 21:25:48', '2026-01-22', '2026-01-31', 'cancelled'),
	(7, 1, 2, '2026-01-09 21:26:14', '2026-01-24', '2026-01-31', 'cancelled'),
	(8, 1, 3, '2026-01-09 21:33:08', '2026-01-30', '2026-01-31', 'cancelled'),
	(9, 1, 1, '2026-01-09 22:00:42', '2026-01-23', '2026-01-30', 'confirmed');

-- Dumping structure for table hotel_booking.rooms
CREATE TABLE IF NOT EXISTS `rooms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `room_name` varchar(100) NOT NULL,
  `price` decimal(10,6) NOT NULL,
  `description` text NOT NULL,
  `status` enum('available','booked') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'available',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table hotel_booking.rooms: ~3 rows (approximately)
DELETE FROM `rooms`;
INSERT INTO `rooms` (`id`, `room_name`, `price`, `description`, `status`) VALUES
	(1, 'Deluxe Suite', 150.000000, 'A luxurious suite with sea view.', 'booked'),
	(2, 'Family Room', 120.000000, 'Spacious room for 4 people.', 'booked'),
	(3, 'Standard Room', 80.000000, 'Comfortable room with a free Wi-Fi.', 'booked');

