-- Adminer 4.7.6 MySQL dump

SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

SET NAMES utf8mb4;

DROP TABLE IF EXISTS `api_auth`;
CREATE TABLE `api_auth` (
  `idapi_auth` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  `luser` int(11) DEFAULT NULL,
  `vlozeny` datetime DEFAULT current_timestamp(),
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`idapi_auth`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `ban_automat`;
CREATE TABLE `ban_automat` (
  `idban_automat` int(11) NOT NULL AUTO_INCREMENT,
  `id_stanice` int(11) DEFAULT NULL,
  `pocet_zprav` int(11) DEFAULT NULL,
  `pocet_minut` int(11) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  `vlozeno` datetime DEFAULT current_timestamp(),
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`idban_automat`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `emails_notify`;
CREATE TABLE `emails_notify` (
  `idemails_notify` int(11) NOT NULL AUTO_INCREMENT,
  `komu` int(11) DEFAULT NULL COMMENT 'iduser',
  `id_stanice` int(11) DEFAULT NULL,
  `vlozeno` datetime DEFAULT current_timestamp(),
  `vlozil` int(11) DEFAULT NULL COMMENT 'iduser',
  `delka_odezvy_v_minutach` int(11) NOT NULL DEFAULT 60 COMMENT 'pocet minut ktere je potreba aspon zprava',
  PRIMARY KEY (`idemails_notify`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `email_sender_define`;
CREATE TABLE `email_sender_define` (
  `idemail_sender_define` int(11) NOT NULL AUTO_INCREMENT,
  `driver` varchar(50) DEFAULT NULL,
  `host` varchar(255) DEFAULT NULL,
  `port` int(11) DEFAULT NULL,
  `username_email` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `encryption` varchar(50) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  `aktivni` int(11) DEFAULT NULL,
  `vlozeno` datetime DEFAULT current_timestamp(),
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`idemail_sender_define`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;

INSERT INTO `email_sender_define` (`idemail_sender_define`, `driver`, `host`, `port`, `username_email`, `password`, `encryption`, `vlozil`, `aktivni`, `vlozeno`, `zmena`) VALUES
(1,	'smtp',	'smtp.gmail.com',	465,	'dpstd2020@gmail.com',	'QwEr4321',	'ssl',	666,	1,	'2020-04-23 17:38:42',	'2020-04-23 15:38:42');


DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
  `idmenu` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  `route` varchar(255) DEFAULT NULL,
  `element` varchar(255) DEFAULT NULL,
  `id_pozice_menu` int(11) DEFAULT NULL,
  PRIMARY KEY (`idmenu`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `menu` (`idmenu`, `nazev`, `route`, `element`, `id_pozice_menu`) VALUES
(1,	'Odhlásit',	'logout',	'logout-form',	1),
(2,	'Přehled',	'prehled',	'prehled',	2),
(3,	'Uživatelé',	'users-index',	'users-index',	2),
(4,	'Čidla',	'stanice-index',	'stanice-index',	2),
(5,	'Nastavení veličin',	'velicina-index',	'velicina',	2),
(6,	'Nastavení WU',	'nastaveniWu-index',	'nastaveniWu',	2),
(7,	'Nastavení upozornění',	'emails-index',	'emails',	2),
(8,	'Nastavení emailu',	'emailSet-index',	'emailSet',	2),
(9,	'Nastavení API',	'apiAuth-index',	'apiAuth',	2),
(10,	'Nastavení témat',	'topic-index',	'topic',	2),
(11,	'Automatický BAN',	'ban-index',	'ban',	2),
(12,	'Nastavení serveru',	'mqtt-index',	'mqtt',	2);

DROP TABLE IF EXISTS `menu_pozice`;
CREATE TABLE `menu_pozice` (
  `id_pozice_menu` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id_pozice_menu`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;

INSERT INTO `menu_pozice` (`id_pozice_menu`, `nazev`) VALUES
(1,	'horniMenu'),
(2,	'leveMenu');

DROP TABLE IF EXISTS `mqtt_data_request`;
CREATE TABLE `mqtt_data_request` (
  `idmqtt_data_request` int(11) NOT NULL AUTO_INCREMENT,
  `id_stanice` int(11) DEFAULT NULL,
  `topic` text DEFAULT NULL,
  `data` text DEFAULT NULL,
  `vlozeny` timestamp NULL DEFAULT current_timestamp(),
  `vlozil` int(11) DEFAULT NULL,
  PRIMARY KEY (`idmqtt_data_request`),
  KEY `idx_stanice` (`id_stanice`),
  KEY `idx_vlozeno` (`vlozeny`)
) ENGINE=InnoDB AUTO_INCREMENT=320198 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `mqtt_topics`;
CREATE TABLE `mqtt_topics` (
  `idmqtt_topic` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  `topic` varchar(255) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  `aktivni` int(11) DEFAULT 0,
  `vlozeny` datetime DEFAULT current_timestamp(),
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`idmqtt_topic`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `mqtt_topics` (`idmqtt_topic`, `nazev`, `topic`, `vlozil`, `aktivni`, `vlozeny`, `zmena`) VALUES
(1,	'default',	'#',	666,	1,	'2020-05-27 18:21:18',	'2020-05-27 16:21:18');


DROP TABLE IF EXISTS `nazvoslovi_velicin`;
CREATE TABLE `nazvoslovi_velicin` (
  `idnazvoslovi_veliciny` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  `jednotka` varchar(25) DEFAULT '-',
  `poznamka` text DEFAULT NULL,
  PRIMARY KEY (`idnazvoslovi_veliciny`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4;

INSERT INTO `nazvoslovi_velicin` (`idnazvoslovi_veliciny`, `nazev`, `jednotka`, `poznamka`) VALUES
(1,	'= Nedefinováno =',	'',	'Nemazat, default'),
(2,	'Teplota',	'°C',	'Nemazat - dulezite na export na WU'),
(3,	'Vlhkost',	'%',	'Nemazat - dulezite na export na WU'),
(4,	'Tlak',	'hPa',	'Nemazat - dulezite na export na WU'),
(5,	'UV',	'',	'Nemazat - dulezite na export na WU'),
(10,	'Napětí',	'V',	NULL),
(12,	'Smog',	'',	NULL);

DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('xspurn05@vutbr.cz',	'$2y$10$R/dI7iK1aAjS8trSleCQe.Aaab8V42i98OixO1gv/RoT24m7/yqli',	'2020-04-04 11:35:58');

DROP TABLE IF EXISTS `request_users`;
CREATE TABLE `request_users` (
  `idrequest_user` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`idrequest_user`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;

INSERT INTO `request_users` (`idrequest_user`, `name`) VALUES
(1,	'Subscriber'),
(2,	'ApiUser');

DROP TABLE IF EXISTS `stanice`;
CREATE TABLE `stanice` (
  `appId` int(11) NOT NULL AUTO_INCREMENT,
  `idStanice` int(11) NOT NULL,
  `nazev` varchar(255) DEFAULT NULL,
  `souradnice_x` float(15,2) DEFAULT NULL,
  `souradnice_y` float(15,2) DEFAULT NULL,
  `adresa` varchar(255) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  `vlozeny` datetime DEFAULT current_timestamp(),
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  `luser` int(11) DEFAULT NULL,
  `registrovano` int(11) DEFAULT 0,
  `ban` int(11) DEFAULT 0,
  PRIMARY KEY (`appId`),
  KEY `idx_stanice` (`idStanice`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;

DROP TABLE IF EXISTS `user_password`;
CREATE TABLE `user_password` (
  `iduser_password` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) DEFAULT NULL,
  `token` varchar(255) DEFAULT NULL,
  `aktivni` int(11) DEFAULT 1,
  `vlozeny` timestamp NULL DEFAULT current_timestamp(),
  `vlozil` int(11) DEFAULT NULL,
  PRIMARY KEY (`iduser_password`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `vizitka_nazvoslovi`;
CREATE TABLE `vizitka_nazvoslovi` (
  `idvizitka_nazvoslovi` int(11) NOT NULL AUTO_INCREMENT,
  `id_vizitka` int(11) NOT NULL,
  `id_nazvoslovi_velicin` int(11) NOT NULL,
  PRIMARY KEY (`idvizitka_nazvoslovi`),
  KEY `idx_id_nazvoslovi_velicin` (`id_nazvoslovi_velicin`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8mb4;

DROP TABLE IF EXISTS `vizitky`;
CREATE TABLE `vizitky` (
  `idVizitky` int(11) NOT NULL AUTO_INCREMENT,
  `id_stanice` int(11) DEFAULT NULL,
  `sloupec_velicina` varchar(255) DEFAULT NULL,
  `zobrazit` int(11) DEFAULT 1,
  `luser` int(11) DEFAULT NULL,
  `zmena` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`idVizitky`),
  KEY `idx_sloupec_velicina` (`sloupec_velicina`)
) ENGINE=InnoDB AUTO_INCREMENT=124 DEFAULT CHARSET=utf8mb4;


DROP TABLE IF EXISTS `wu_definice_pristupu`;
CREATE TABLE `wu_definice_pristupu` (
  `idwu_definice_pristupu` int(11) NOT NULL AUTO_INCREMENT,
  `id_stanice` int(11) NOT NULL,
  `pass` varchar(50) DEFAULT NULL,
  `id_wu_station` varchar(50) DEFAULT NULL,
  `last_export` datetime DEFAULT NULL,
  PRIMARY KEY (`idwu_definice_pristupu`),
  UNIQUE KEY `wu_definice_pristupu_idStanice_uindex` (`id_stanice`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;



DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(11) AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1,	'ObnovaHesla',	'obnovahesla@dpstd.cz',	'2020-04-25 13:54:43',	'$2y$10$CigiK8BT/DATbThWe/Tt0uVxrGcBJTypgythDIti0VvvticqaOcUm',	NULL,	NULL,	NULL),
(2,	'Petr Číka',	'cika@feec.vutbr.cz',	'2020-04-25 12:28:26',	'$2y$10$238vRKWoyyR6y.ObpNf8iuJSysm4PVhwkRRq6S/lsQLLRhpF.7Rqa',	NULL,	'2020-04-19 06:42:53',	'2020-04-19 06:42:53'),
(666,	'Administrator',	'dpstd2020@gmail.com',	'2020-04-25 14:27:41',	'$2y$10$vhdxZfam9mS0vHDbBjmO/ufS1ByLL1.FFboWIqzlztzT3vKoZ42Dm',	'tyTIRJznvnf8nzgl3113q46PQfD4BpZSAnN9AJA1mBG4UIwcmHA1LaxUa5Tl',	'2020-04-04 08:30:34',	'2020-04-25 14:27:41');


DROP TABLE IF EXISTS `mqtt_server_set`;
CREATE TABLE `mqtt_server_set` (
  `idmqtt_server_set` int(11) NOT NULL AUTO_INCREMENT,
  `nazev` varchar(255) DEFAULT NULL,
  `ipadresa` varchar(255) DEFAULT NULL,
  `aktivni` int(11) DEFAULT NULL,
  `vlozil` int(11) DEFAULT NULL,
  PRIMARY KEY (`idmqtt_server_set`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `mqtt_server_set` (`idmqtt_server_set`, `nazev`, `ipadresa`, `aktivni`, `vlozil`) VALUES
(1,	'mqtt skolni server',	147.229.148.14,	666);

DROP TABLE IF EXISTS `request_users`;
CREATE TABLE `request_users` (
  `idrequest_user` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`idrequest_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `request_users` (`idrequest_user`, `name`) VALUES
(1,	'Subscriber'),
(2,	'ApiUser');

-- 2020-05-01 11:56:19
