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

START TRANSACTION;



--
-- Database: `busx_iot`
--

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

--
-- Table structure for table `gps_current_location`
--

CREATE TABLE `gps_current_location` (
  `vehicle_id` varchar(50) NOT NULL,
  `compcode` varchar(50) DEFAULT NULL,
  `latitude` decimal(10,8) DEFAULT NULL,
  `longitude` decimal(11,8) DEFAULT NULL,
  `location` point NOT NULL,
  `speed` decimal(5,2) UNSIGNED NOT NULL DEFAULT 0.00,
  `direction` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
  `engine_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `gps_time` datetime DEFAULT NULL COMMENT 'local time',
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Auto insert by system';

--
-- Indexes for dumped tables
--

--
-- Indexes for table `gps_current_location`
--
ALTER TABLE `gps_current_location`
  ADD PRIMARY KEY (`vehicle_id`),
  ADD SPATIAL KEY `location` (`location`),
  ADD KEY `updated_at` (`updated_at`),
  ADD KEY `compcode` (`compcode`);
COMMIT;

