text: -- phpMyAdmin SQL Dump
  -- version 5.0.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Feb 14, 2021 at 05:13 PM
  -- Server version: 10.4.16-MariaDB
  -- PHP Version: 7.4.12
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  START TRANSACTION;
  SET time_zone = "+00:00";
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8mb4 */;
  
  --
  -- Database: `inventory`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `item`
  --
  
  CREATE TABLE `item` (
    `id` int(11) NOT NULL,
    `image_url` varchar(255) DEFAULT NULL,
    `name` varchar(255) NOT NULL,
    `original_filename` varchar(255) DEFAULT NULL,
    `price` int(11) NOT NULL,
    `unit_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `item`
  --
  
  INSERT INTO `item` (`id`, `image_url`, `name`, `original_filename`, `price`, `unit_id`) VALUES
  (1, '/api/items/image/c45121ff-f43d-4830-af9d-6c2f80b1f0db.jpg', 'Beng beng', 'bengbeng.jpg', 20000, 2),
  (2, '/api/items/image/b9d4a5b4-c588-4f3c-8604-af6f33553836.png', 'Indomie', 'indomie.png', 100000, 2),
  (3, '/api/items/image/87f24b8c-5493-434e-abd1-06304ce600c3.jpg', 'Beras', 'beras.jpg', 10000, 1),
  (4, '/api/items/image/b05caf46-5be4-4ab2-8b5b-05d6e49b5da8.jpg', 'Jeruk', 'jeruk.jpg', 10000, 1),
  (5, '/api/items/image/e7e7d0af-7f49-4270-84ac-752cb5837949.jpg', 'Nutrisari', 'nutrisari.jpg', 10000, 3);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `roles`
  --
  
  CREATE TABLE `roles` (
    `id` int(11) NOT NULL,
    `name` varchar(20) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `roles`
  --
  
  INSERT INTO `roles` (`id`, `name`) VALUES
  (1, 'ROLE_USER'),
  (2, 'ROLE_MODERATOR'),
  (3, 'ROLE_ADMIN');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `stock`
  --
  
  CREATE TABLE `stock` (
    `id` int(11) NOT NULL,
    `quantity` int(11) NOT NULL,
    `item_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `stock`
  --
  
  INSERT INTO `stock` (`id`, `quantity`, `item_id`) VALUES
  (1, 10, 1),
  (2, 5, 2),
  (3, 100, 3),
  (4, 20, 4),
  (5, 20, 5),
  (6, 2, 5),
  (7, 2, 4),
  (8, 2, 3),
  (9, 2, 2),
  (10, 2, 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `unit`
  --
  
  CREATE TABLE `unit` (
    `id` int(11) NOT NULL,
    `code` varchar(255) NOT NULL,
    `description` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `unit`
  --
  
  INSERT INTO `unit` (`id`, `code`, `description`) VALUES
  (1, 'kg', 'Kilogram'),
  (2, 'pack', 'Package'),
  (3, 'rcg', 'Renceng');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `id` int(11) NOT NULL,
    `email` varchar(50) DEFAULT NULL,
    `password` varchar(120) DEFAULT NULL,
    `username` varchar(20) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `user`
  --
  
  INSERT INTO `user` (`id`, `email`, `password`, `username`) VALUES
  (1, 'admin@admin.com', '$2a$10$xcqxNon2wIs8SgT84ARzuuvVz8l1xfu9YAvldoU.ks/4I.DiKyRD2', 'admin');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user_roles`
  --
  
  CREATE TABLE `user_roles` (
    `id` int(11) NOT NULL,
    `user_id` int(20) NOT NULL,
    `role_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `user_roles`
  --
  
  INSERT INTO `user_roles` (`id`, `user_id`, `role_id`) VALUES
  (1, 1, 1);
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `item`
  --
  ALTER TABLE `item`
    ADD PRIMARY KEY (`id`),
    ADD KEY `unit_id` (`unit_id`);
  
  --
  -- Indexes for table `roles`
  --
  ALTER TABLE `roles`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `stock`
  --
  ALTER TABLE `stock`
    ADD PRIMARY KEY (`id`),
    ADD KEY `item_id` (`item_id`);
  
  --
  -- Indexes for table `unit`
  --
  ALTER TABLE `unit`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `user_roles`
  --
  ALTER TABLE `user_roles`
    ADD PRIMARY KEY (`id`),
    ADD KEY `role_id` (`role_id`),
    ADD KEY `user_id` (`user_id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `item`
  --
  ALTER TABLE `item`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
  
  --
  -- AUTO_INCREMENT for table `roles`
  --
  ALTER TABLE `roles`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `stock`
  --
  ALTER TABLE `stock`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
  
  --
  -- AUTO_INCREMENT for table `unit`
  --
  ALTER TABLE `unit`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `user_roles`
  --
  ALTER TABLE `user_roles`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `item`
  --
  ALTER TABLE `item`
    ADD CONSTRAINT `item_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `stock`
  --
  ALTER TABLE `stock`
    ADD CONSTRAINT `stock_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `user_roles`
  --
  ALTER TABLE `user_roles`
    ADD CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  COMMIT;
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  