text: -- phpMyAdmin SQL Dump
  -- version 5.1.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Dec 09, 2021 at 03:04 PM
  -- Server version: 10.4.21-MariaDB
  -- PHP Version: 8.0.11
  
  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: `jjjwcdzy_greenhouse`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `devices`
  --
  
  CREATE TABLE `devices` (
    `id` int(11) NOT NULL,
    `code` text NOT NULL,
    `position` varchar(128) NOT NULL,
    `description` varchar(128) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `devices`
  --
  
  INSERT INTO `devices` (`id`, `code`, `position`, `description`) VALUES
  (1, 'TomatoDevice', 'Tomato Pot', 'Tomato Pot Here');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `logs`
  --
  
  CREATE TABLE `logs` (
    `id` int(11) NOT NULL,
    `device_id` int(11) DEFAULT NULL,
    `temperature` int(12) DEFAULT NULL,
    `moisture` int(12) DEFAULT NULL,
    `time_log` datetime NOT NULL DEFAULT current_timestamp()
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `logs`
  --
  
  INSERT INTO `logs` (`id`, `device_id`, `temperature`, `moisture`, `time_log`) VALUES
  (8, 1, 100, 100, '2021-12-09 22:03:23'),
  (9, 1, 90, 200, '2021-12-09 22:03:35'),
  (10, 1, 80, 300, '2021-12-09 22:03:39'),
  (11, 1, 0, 0, '2021-12-09 22:03:44'),
  (12, 1, 100, 100, '2021-12-09 22:03:48');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `devices`
  --
  ALTER TABLE `devices`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `logs`
  --
  ALTER TABLE `logs`
    ADD PRIMARY KEY (`id`),
    ADD KEY `device_id` (`device_id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `devices`
  --
  ALTER TABLE `devices`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `logs`
  --
  ALTER TABLE `logs`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `logs`
  --
  ALTER TABLE `logs`
    ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `devices` (`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 */;
  