-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `pawpal_db`
--

-- --------------------------------------------------------

--
-- Table structure for table `tbl_adoptions`
--

CREATE TABLE `tbl_adoptions` (
  `pet_id` int(5) NOT NULL,
  `adopter_user_id` int(5) NOT NULL,
  `reason` text NOT NULL,
  `requested_at` datetime(6) NOT NULL DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_adoptions`
--

INSERT INTO `tbl_adoptions` (`pet_id`, `adopter_user_id`, `reason`, `requested_at`) VALUES
(18, 3, 'I would like to adopt this pet beacuse I love birds', '2026-01-10 15:39:58.553370'),
(18, 8, 'I wanna adopt this pet', '2026-01-10 22:36:27.611561'),
(23, 2, 'I would like to adopt this pet', '2026-01-10 21:27:33.300325'),
(23, 8, 'I wanna adopt this pet', '2026-01-10 22:38:09.921009');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_donation`
--

CREATE TABLE `tbl_donation` (
  `donation_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `pet_id` int(11) NOT NULL,
  `donation_type` enum('Food','Medical','Money') NOT NULL,
  `amount` decimal(10,2) DEFAULT 0.00,
  `donation_description` text DEFAULT NULL,
  `donation_date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_donation`
--

INSERT INTO `tbl_donation` (`donation_id`, `user_id`, `pet_id`, `donation_type`, `amount`, `donation_description`, `donation_date`) VALUES
(1, 2, 22, 'Medical', 0.00, 'i wanna donate some medication for this pet.', '2026-01-10 17:05:08'),
(2, 2, 22, 'Food', 0.00, 'I would like to provide some food for this pet', '2026-01-10 21:31:50'),
(3, 2, 22, 'Money', 50.00, '', '2026-01-10 21:35:18'),
(4, 8, 25, 'Food', 0.00, 'I have some food for you.', '2026-01-10 22:34:55'),
(5, 8, 22, 'Money', 50.00, '', '2026-01-10 22:40:23');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_pets`
--

CREATE TABLE `tbl_pets` (
  `pet_id` int(5) NOT NULL,
  `user_id` int(5) NOT NULL,
  `pet_name` varchar(100) NOT NULL,
  `pet_type` varchar(50) NOT NULL,
  `gender` varchar(6) NOT NULL,
  `age` int(10) NOT NULL,
  `health` varchar(50) NOT NULL,
  `category` varchar(50) NOT NULL,
  `description` text NOT NULL,
  `image_paths` text NOT NULL,
  `lat` varchar(50) NOT NULL,
  `lng` int(11) NOT NULL,
  `created_at` datetime(6) NOT NULL DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_pets`
--

INSERT INTO `tbl_pets` (`pet_id`, `user_id`, `pet_name`, `pet_type`, `gender`, `age`, `health`, `category`, `description`, `image_paths`, `lat`, `lng`, `created_at`) VALUES
(18, 2, 'Richy', 'Bird', 'Male', 3, 'Healthy', 'Adoption', 'This bird is available for adoption', '[\"uploads/pet_18_0.png\"]', '5.4001664', 100, '2026-01-10 14:28:35.810811'),
(19, 2, 'Coco', 'Dog', 'Female', 6, 'Healthy', 'Donation', 'Financial support is required for this pet.', '[\"uploads/pet_19_0.png\",\"uploads/pet_19_1.png\",\"uploads/pet_19_2.png\"]', '5.4001664', 100, '2026-01-10 14:29:46.149792'),
(20, 2, 'Goldy', 'Fish', 'Male', 2, 'Healthy', 'Donation', 'This pet needs financial support', '[\"uploads/pet_20_0.png\",\"uploads/pet_20_1.png\"]', '5.4001664', 100, '2026-01-10 14:41:32.290886'),
(21, 3, 'Mongua', 'Cat', 'Female', 4, 'Healthy', 'Help/Rescure', 'This pet needs help', '[\"uploads/pet_21_0.png\",\"uploads/pet_21_1.png\"]', '5.4072755', 100, '2026-01-10 14:43:31.091279'),
(22, 3, 'Parry', 'Bird', 'Female', 2, 'Weak', 'Donation', 'This pet needs money for treatment', '[\"uploads/pet_22_0.png\",\"uploads/pet_22_1.png\",\"uploads/pet_22_2.png\"]', '5.4072755', 100, '2026-01-10 14:45:24.871615'),
(23, 3, 'Rata', 'Rabbit', 'Female', 4, 'Average', 'Adoption', 'This pet is looking for an owner', '[\"uploads/pet_23_0.png\",\"uploads/pet_23_1.png\"]', '5.4001664', 100, '2026-01-10 14:58:35.147504'),
(24, 2, 'Raitu', 'Dog', 'Male', 2, 'Healthy', 'Adoption', 'This pet is looking for an owner to adopt', '[\"uploads/pet_24_0.png\",\"uploads/pet_24_1.png\"]', '5.4001664', 100, '2026-01-10 21:24:48.336730'),
(25, 8, 'Richard', 'Rabbit', 'Female', 2, 'Healthy', 'Donation', 'I want financial help', '[\"uploads/pet_25_0.png\",\"uploads/pet_25_1.png\"]', '5.4001664', 100, '2026-01-10 22:33:39.770415');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `tbl_adoptions`
--
ALTER TABLE `tbl_adoptions`
  ADD UNIQUE KEY `pet_id` (`pet_id`,`adopter_user_id`);

--
-- Indexes for table `tbl_donation`
--
ALTER TABLE `tbl_donation`
  ADD PRIMARY KEY (`donation_id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `pet_id` (`pet_id`);

--
-- Indexes for table `tbl_pets`
--
ALTER TABLE `tbl_pets`
  ADD PRIMARY KEY (`pet_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tbl_donation`
--
ALTER TABLE `tbl_donation`
  MODIFY `donation_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `tbl_pets`
--
ALTER TABLE `tbl_pets`
  MODIFY `pet_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `tbl_donation`
--
ALTER TABLE `tbl_donation`
  ADD CONSTRAINT `tbl_donation_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`user_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tbl_donation_ibfk_2` FOREIGN KEY (`pet_id`) REFERENCES `tbl_pets` (`pet_id`) ON DELETE CASCADE;
COMMIT;

