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

START TRANSACTION;



--
-- Database: `repairmanagement`
--

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

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
  `adminId` varchar(10) NOT NULL,
  `firstName` varchar(100) NOT NULL,
  `lastName` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`adminId`, `firstName`, `lastName`, `email`, `password`) VALUES
('A001', 'SAURACHAT', 'LIMRATTANAP', 'titlemy36@gmail.com', '$2y$10$F7mSwvt4Bm1K8etCB7T8/OjyyTJal59k7FRtRR.i6x.bAjoQRZvhG'),
('A002', 'achita', 'boonniam', 'ppcllaearg@gmail.com', '$2y$10$kpfGmb1WPI3EGRDb20SAC..JfsCKSePBFeaMTuNLT4VKXfRzfTs6y');

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

--
-- Table structure for table `employee`
--

CREATE TABLE `employee` (
  `empId` varchar(100) NOT NULL,
  `firstName` varchar(100) NOT NULL,
  `lastName` varchar(100) NOT NULL,
  `department` varchar(50) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employee`
--

INSERT INTO `employee` (`empId`, `firstName`, `lastName`, `department`, `username`, `password`, `email`) VALUES
('E001', 'อชิตา', 'บุญเนียม', '1', 'Achita24', '81dc9bdb52d04dc20036dbd8313ed055', 'ppcllaearg@gmail.com'),
('E002', 'อชิตา', 'บุญเนียม', '4', 'Earth2412', '186fb23a33995d91ce3c2212189178c8', 'ppcllaearg@gmail.com'),
('E003', 'อชิตา', 'บุญเนียม', '1', 'aaa', 'fa246d0262c3925617b0c72bb20eeb1d', 'ppcllaearg@gmail.com'),
('E004', 'เทจ', 'เทจ', '3', 'ttt', '2be9bd7a3434f7038ca27d1918de58bd', 'ppcllaearg@gmail.com'),
('E005', 'อชิตา', 'บุญเนียม', '2', 'www', 'b59c67bf196a4758191e42f76670ceba', 'ppcllaearg@gmail.com'),
('E006', 'พิชญ์สินี', 'ปรากฏ', '4', 'ice', '45f31d16b1058d586fc3be7207b58053', 'ppcllaearg@gmail.com'),
('E007', 'อชิตา', 'บุญเนียม', '1', 'ice14', 'b59c67bf196a4758191e42f76670ceba', 'ppcllaearg@gmail.com'),
('E008', 'พิชญ์สินี', 'บุญเนียม', '3', '้้้้้้hhh', 'b59c67bf196a4758191e42f76670ceba', 'ppcllaearg@gmail.com'),
('E009', 'อชิตา', 'บุญเนียม', '3', 'tt', '81dc9bdb52d04dc20036dbd8313ed055', 'ppcllaearg@gmail.com');

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

--
-- Table structure for table `product`
--

CREATE TABLE `product` (
  `productId` varchar(100) NOT NULL,
  `productName` varchar(100) NOT NULL,
  `brand` varchar(100) NOT NULL,
  `department` varchar(100) NOT NULL,
  `type` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `product`
--

INSERT INTO `product` (`productId`, `productName`, `brand`, `department`, `type`) VALUES
('1000-405-3322-1456/12', 'Printer', 'Broter', '2', 'Printer'),
('1111-444-5555-1234/14', 'UPS', 'APC ', '3', 'UPS'),
('1234-567-8910-1112/01', 'Computer', 'Asus', '1', 'PC'),
('1345-543-1345-3421/01', 'UPS', 'APC ', '3', 'UPS');

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

--
-- Table structure for table `repair`
--

CREATE TABLE `repair` (
  `repairId` varchar(100) NOT NULL,
  `empId` varchar(100) NOT NULL,
  `productId` varchar(100) NOT NULL,
  `description` varchar(200) NOT NULL,
  `date` varchar(50) NOT NULL,
  `dateEnd` varchar(50) DEFAULT NULL,
  `state` varchar(1) NOT NULL,
  `email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `repair`
--

INSERT INTO `repair` (`repairId`, `empId`, `productId`, `description`, `date`, `dateEnd`, `state`, `email`) VALUES
('N0001', 'E001', '1234-567-8910-1112/01', 'เปิดไม่ติด', '2025-02-17', '2025-02-17', '2', 'ppcllaearg@gmail.com'),
('N002', 'E002', '1234-567-8910-1112/01', 'เปิดไม่ติด', '2025-02-17', '2025-02-17', '2', 'ppcllaearg@gmail.com'),
('N003', 'E003', '1234-567-8910-1112/01', 'เปิดไม่ติด', '2025-02-18', '2025-02-18', '2', 'ppcllaearg@gmail.com'),
('N004', 'E005', '1000-405-3322-1456/12', 'กระดาษติด', '2025-02-18', '2025-02-18', '2', 'ppcllaearg@gmail.com'),
('N005', 'E007', '1234-567-8910-1112/01', 'เปิดไม่ติด', '2025-02-18', '2025-02-18', '2', 'ppcllaearg@gmail.com'),
('N006', 'E009', '1111-444-5555-1234/14', 'เปิดไม่ติด', '2025-02-18', NULL, '1', 'ppcllaearg@gmail.com');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
  ADD PRIMARY KEY (`adminId`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `employee`
--
ALTER TABLE `employee`
  ADD PRIMARY KEY (`empId`);

--
-- Indexes for table `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`productId`);

--
-- Indexes for table `repair`
--
ALTER TABLE `repair`
  ADD PRIMARY KEY (`repairId`),
  ADD KEY `productKey` (`productId`),
  ADD KEY `repair_ibfk_1` (`empId`);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `repair`
--
ALTER TABLE `repair`
  ADD CONSTRAINT `productKey` FOREIGN KEY (`productId`) REFERENCES `product` (`productId`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `repair_ibfk_1` FOREIGN KEY (`empId`) REFERENCES `employee` (`empId`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

