CREATE DATABASE IF NOT EXISTS db_smartsafe;
CREATE DATABASE IF NOT EXISTS db_ping;

USE db_ping;
CREATE TABLE `ping_queues` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `client_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `terminal_id` int NOT NULL,
  `door` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `function` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `power` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `signal` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `printer` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `custodylimit` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `billmaxquant` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `coinmaxquant` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastbillcollect` timestamp NOT NULL,
  `lastbillamount` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastcoinamount` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastenvelopelcollect` timestamp NOT NULL,
  `lastenvelopeamount` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastenvelopecount` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `presentbillvalue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `presentcoinvalue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `presentenvelopevalue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `coiledbill` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `details` longtext COLLATE utf8mb4_unicode_ci,
  `billquantity` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `coinquantity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `presentchangesvalue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `recyclerquantity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `presentrecyclervalue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastrecycleramount` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `inconsistency` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `latch` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `k7state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDENTE',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6877 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;