
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


CREATE TABLE `op_messages` (
  `id` int NOT NULL,
  `source_url` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `topic` varchar(50) NOT NULL DEFAULT '',
  `direction` varchar(255) NOT NULL DEFAULT '',
  `connection_id` int NOT NULL DEFAULT 0,
  `ocpp_endpoint` varchar(25) DEFAULT NULL,
  `message` longtext CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `timestamp` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `op_messages` (`id`, `source_url`, `topic`, `direction`, `connection_id`, `ocpp_endpoint`, `message`, `timestamp`) VALUES
(21011, '/ocpp16/NEXT-WS114794', 'TACW1144322G1481', 'server_to_client', 1, 'chargeatwork', '[2,\"3410ba81-81f2-4417-a722-c5c84c532bdc\",\"RemoteStartTransaction\",{\"connectorId\":1,\"idTag\":\"TACW1144322G1481\"}]', '2025-06-03 17:16:54');

ALTER TABLE `op_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_timestamp` (`timestamp`),
  ADD KEY `idx_station_id` (`source_url`),
  ADD KEY `topic` (`topic`),
  ADD KEY `idx_connection` (`connection_id`);


ALTER TABLE `op_messages`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53739;
COMMIT;
