-- Adminer 4.8.1 MySQL 10.3.34-MariaDB-0+deb10u1 dump


SET foreign_key_checks = 0;

SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';


CREATE TABLE `configuration`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `module` int(11) NOT NULL,
    `group` varchar(255) NOT NULL COMMENT 'base',
    `key` varchar(255) NOT NULL,
    `value` text DEFAULT NULL,
    `type` enum('integer', 'number', 'alpha', 'date', 'email', 'emails', 'url', 'checkbox', 'select', 'text', 'formatted_text', 'file', 'color') DEFAULT NULL,
    `values` text DEFAULT NULL COMMENT 'Trieda::metóda, alebo hodnoty vo formáte Meno 1/hodnota1,Meno 2/hodnota2, ...',
    `label` varchar(255) NOT NULL,
    `note` text DEFAULT NULL,
    `order` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `module_group_key`(`module`, `group`, `key`),
    KEY `group`(`group`),
    CONSTRAINT `configuration_ibfk_2` FOREIGN KEY (`module`) REFERENCES `modules`(`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `configuration`(`id`, `module`, `group`, `key`, `value`, `type`, `values`, `label`, `note`, `order`)
    VALUES (3, 1, 'base', 'email', '', 'email', NULL, 'Hlavný kontaktný e-mail', NULL, 30),
(46, 3, 'photos', 'dir', '/files/photos', NULL, NULL, 'Zložka', 'Cesta k zložke kde sú uložené fotografie', 10),
(47, 3, 'photos', 'max_width', '687', NULL, NULL, 'Maximálna šírka vkladaných fotografií', '', 20),
(48, 3, 'hotspots', 'width', '25', 'integer', NULL, 'Šírka ikony', NULL, 30),
(49, 3, 'hotspots', 'dir', '/gfx/hotspots-icons', NULL, NULL, 'Zložka s ikonami', NULL, 20),
(50, 3, 'hotspots', 'height', '25', 'integer', NULL, 'Výška ikony', NULL, 40),
(51, 3, 'hotspots', 'allow', '', 'checkbox', NULL, 'Povoliť', 'Povoliť vkladanie interaktívnych bodov do fotografií.', 10),
(52, 3, 'hotspots', 'object_width', '260', 'integer', NULL, 'Šírka', 'Šírka fotografie alebo videa vloženého do bodu', 50),
(53, 3, 'hotspots', 'object_height', '210', 'integer', NULL, 'Výška', 'Výška fotografie alebo videa vloženého do bodu', 60),
(54, 3, 'hotspots', 'thumb_width', '50', 'integer', NULL, 'Šírka náhľadu', 'Šírka náhľadu fotografie alebo videa vloženého do bodu', 60),
(55, 3, 'hotspots', 'thumb_height', '30', 'integer', NULL, 'Výška náhľadu', 'Výška náhľadu fotografie alebo videa vloženého do bodu', 70),
(131, 3, 'photos', 'watermark', '/files/configuration/PhotoManager/photos/watermark/5b80af25ad11f4dff7e35a24c83d587d7b602c8f', 'file', NULL, 'Vodotlač', 'Súbor ktorý sa aplikuje ako vodotlač na fotografie', 1000),
(730, 3, 'photos', 'watermark_position_horizontal', 'center', 'select', 'left\r\ncenter\r\nright', 'Hor. umiestnenie vodotlače', NULL, 1010),
(731, 3, 'photos', 'watermark_position_vertical', 'center', 'select', 'top\r\ncenter\r\nbottom', 'Vert. umiestnenie vodotlače', NULL, 1020),
(780, 3, 'photos', 'watermark_min_height', '120', 'number', NULL, 'Min. výška fotografie pre vodotlač', NULL, 1030),
(781, 3, 'photos', 'watermark_min_width', '180', 'integer', NULL, 'Min. šírka fotografie pre vodotlač', NULL, 1025),
(812, 2, 'search_target', 'page', '1', 'checkbox', NULL, 'Vyhľadávať na stránkach', NULL, 10),
(813, 3, 'search_target', 'photo', '', 'checkbox', NULL, 'Vyhľadávať vo fotografiách', NULL, 20),
(814, 3, 'search_target', 'gallery', '', 'checkbox', NULL, 'Vyhľadávať vo fotogalériach', NULL, 30);


CREATE TABLE `countries`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `nazov`(`name`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `countries`(`id`, `name`)
    VALUES (1, 'Afghanistan'),
(2, 'Albania'),
(3, 'Algeria'),
(4, 'American Samoa'),
(5, 'Andorra'),
(6, 'Angola'),
(7, 'Anguilla'),
(8, 'Antarctica'),
(9, 'Antigua And Barbuda'),
(10, 'Argentina'),
(11, 'Armenia'),
(12, 'Aruba'),
(13, 'Australia'),
(14, 'Austria'),
(15, 'Azerbaijan'),
(16, 'Bahamas'),
(17, 'Bahrain'),
(18, 'Bangladesh'),
(19, 'Barbados'),
(20, 'Belarus'),
(21, 'Belgium'),
(22, 'Belize'),
(23, 'Benin'),
(24, 'Bermuda'),
(25, 'Bhutan'),
(26, 'Bolivia'),
(27, 'Bosnia And Herzegovina'),
(28, 'Botswana'),
(29, 'Bouvet Island'),
(30, 'Brazil'),
(31, 'British Indian Ocean Territory'),
(32, 'Brunei Darussalam'),
(33, 'Bulgaria'),
(34, 'Burkina Faso'),
(35, 'Burundi'),
(36, 'Cambodia'),
(37, 'Cameroon'),
(38, 'Canada'),
(39, 'Cape Verde'),
(40, 'Cayman Islands'),
(41, 'Central African Republic'),
(42, 'Chad'),
(43, 'Chile'),
(44, 'China'),
(45, 'Christmas Island'),
(46, 'Cocos Islands'),
(47, 'Colombia'),
(48, 'Comoros'),
(49, 'Congo'),
(50, 'Cook Islands'),
(51, 'Costa Rica'),
(52, 'Cote Divoire'),
(53, 'Croatia'),
(54, 'Cuba'),
(55, 'Cyprus'),
(56, 'Czech Republic'),
(57, 'Denmark'),
(58, 'Djibouti'),
(59, 'Dominica'),
(60, 'Dominican Republic'),
(61, 'East Timor'),
(62, 'Ecuador'),
(63, 'Egypt'),
(64, 'El Salvador'),
(65, 'Equatorial Guinea'),
(66, 'Eritrea'),
(67, 'Estonia'),
(68, 'Ethiopia'),
(69, 'Falkland Islands'),
(70, 'Faroe Islands'),
(71, 'Fiji'),
(72, 'Finland'),
(73, 'France'),
(74, 'French Guiana'),
(75, 'French Polynesia'),
(76, 'French Southern Territories'),
(77, 'Gabon'),
(78, 'Gambia'),
(79, 'Georgia'),
(80, 'Germany'),
(81, 'Ghana'),
(82, 'Gibraltar'),
(83, 'Greece'),
(84, 'Greenland'),
(85, 'Grenada'),
(86, 'Guadeloupe'),
(87, 'Guam'),
(88, 'Guatemala'),
(89, 'Guinea'),
(90, 'Guinea-bissau'),
(91, 'Guyana'),
(92, 'Haiti'),
(93, 'Heard Island & Mcdonald Islands'),
(94, 'Honduras'),
(95, 'Hong Kong'),
(96, 'Hungary'),
(97, 'Iceland'),
(98, 'India'),
(99, 'Indonesia'),
(100, 'Iran, Islamic Republic Of'),
(101, 'Iraq'),
(102, 'Ireland'),
(103, 'Israel'),
(104, 'Italy'),
(105, 'Jamaica'),
(106, 'Japan'),
(107, 'Jordan'),
(108, 'Kazakhstan'),
(109, 'Kenya'),
(110, 'Kiribati'),
(111, 'Korea, Democratic Peoples Republic Of'),
(112, 'Korea, Republic Of'),
(113, 'Kuwait'),
(114, 'Kyrgyzstan'),
(115, 'Lao Peoples Democratic Republic'),
(116, 'Latvia'),
(117, 'Lebanon'),
(118, 'Lesotho'),
(119, 'Liberia'),
(120, 'Libyan Arab Jamahiriya'),
(121, 'Liechtenstein'),
(122, 'Lithuania'),
(123, 'Luxembourg'),
(124, 'Macau'),
(125, 'Macedonia'),
(126, 'Madagascar'),
(127, 'Malawi'),
(128, 'Malaysia'),
(129, 'Maldives'),
(130, 'Mali'),
(131, 'Malta'),
(132, 'Marshall Islands'),
(133, 'Martinique'),
(134, 'Mauritania'),
(135, 'Mauritius'),
(136, 'Mayotte'),
(137, 'Mexico'),
(138, 'Micronesia, Federated States Of'),
(139, 'Moldova, Republic Of'),
(140, 'Monaco'),
(141, 'Mongolia'),
(142, 'Montserrat'),
(143, 'Morocco'),
(144, 'Mozambique'),
(145, 'Myanmar'),
(146, 'Namibia'),
(147, 'Nauru'),
(148, 'Nepal'),
(149, 'Netherlands'),
(150, 'Netherlands Antilles'),
(151, 'New Caledonia'),
(152, 'New Zealand'),
(153, 'Nicaragua'),
(154, 'Niger'),
(155, 'Nigeria'),
(156, 'Niue'),
(157, 'Norfolk Island'),
(158, 'Northern Mariana Islands'),
(159, 'Norway'),
(160, 'Oman'),
(161, 'Pakistan'),
(162, 'Palau'),
(163, 'Panama'),
(164, 'Papua New Guinea'),
(165, 'Paraguay'),
(166, 'Peru'),
(167, 'Philippines'),
(168, 'Pitcairn'),
(169, 'Poland'),
(170, 'Portugal'),
(171, 'Puerto Rico'),
(172, 'Qatar'),
(173, 'Reunion'),
(174, 'Romania'),
(175, 'Russian Federation'),
(176, 'Rwanda'),
(177, 'Saint Helena'),
(178, 'Saint Kitts And Nevis'),
(179, 'Saint Lucia'),
(180, 'Saint Pierre And Miquelon'),
(181, 'Saint Vincent And The Grenadines'),
(182, 'Samoa'),
(183, 'San Marino'),
(184, 'Sao Tome And Principe'),
(185, 'Saudi Arabia'),
(186, 'Senegal'),
(187, 'Serbia'),
(188, 'Seychelles'),
(189, 'Sierra Leone'),
(190, 'Singapore'),
(191, 'Slovakia'),
(192, 'Slovenia'),
(193, 'Solomon Islands'),
(194, 'Somalia'),
(195, 'South Africa'),
(196, 'Spain'),
(197, 'Sri Lanka'),
(198, 'Sudan'),
(199, 'Suriname'),
(200, 'Svalbard And Jan Mayen Islands'),
(201, 'Swaziland'),
(202, 'Sweden'),
(203, 'Switzerland'),
(204, 'Syrian Arab Republic'),
(205, 'Taiwan, Province Of China'),
(206, 'Tajikistan'),
(207, 'Tanzania, United Republic Of'),
(208, 'Tatarstan'),
(209, 'Thailand'),
(210, 'Togo'),
(211, 'Tokelau'),
(212, 'Tonga'),
(213, 'Trinidad And Tobago'),
(214, 'Tunisia'),
(215, 'Turkey'),
(216, 'Turkmenistan'),
(217, 'Turks And Caicos Islands'),
(218, 'Tuvalu'),
(219, 'Uganda'),
(220, 'Ukraine'),
(221, 'United Arab Emirates'),
(222, 'United Kingdom'),
(223, 'United States'),
(224, 'United States Minor Outlying Islands'),
(225, 'Uruguay'),
(226, 'Uzbekistan'),
(227, 'Vanuatu'),
(228, 'Vatican City State'),
(229, 'Venezuela'),
(230, 'Viet Nam'),
(231, 'Virgin Islands [british]'),
(232, 'Virgin Islands [u.s.]'),
(233, 'Wallis And Futuna Islands'),
(234, 'Western Sahara'),
(235, 'Yemen'),
(236, 'Zaire'),
(237, 'Zambia'),
(238, 'Zimbabwe');


CREATE TABLE `emails`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(),
    `module` varchar(255) DEFAULT NULL,
    `from` varchar(255) NOT NULL,
    `name_from` varchar(255) NOT NULL,
    `to` varchar(255) NOT NULL,
    `name_to` varchar(255) NOT NULL,
    `cc` mediumblob DEFAULT NULL,
    `bcc` mediumblob DEFAULT NULL,
    `subject` varchar(255) NOT NULL,
    `message` mediumtext DEFAULT NULL,
    `message_html` mediumtext DEFAULT NULL,
    `error` tinyint(4) NOT NULL DEFAULT 0,
    `error_message` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `module`(`module`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `files`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `folder` int(11) DEFAULT NULL,
    `original_filename` varchar(255) NOT NULL,
    `filename` char(40) NOT NULL,
    `user` int(11) NOT NULL,
    `password` char(80) DEFAULT NULL,
    `created` datetime NOT NULL,
    `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(),
    `importance` tinyint(4) DEFAULT NULL,
    `downloads` mediumint(9) NOT NULL DEFAULT 0,
    `size` int(11) NOT NULL,
    `description` varchar(255) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `folder`(`folder`),
    KEY `user_id`(`user`),
    CONSTRAINT `files_ibfk_3` FOREIGN KEY (`folder`) REFERENCES `files_folders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `files_ibfk_4` FOREIGN KEY (`user`) REFERENCES `users`(`id`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `files_folders`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `parent` int(11) DEFAULT NULL,
    `name` varchar(255) NOT NULL,
    `user` int(11) NOT NULL,
    `created` datetime NOT NULL,
    `updated` timestamp NULL DEFAULT NULL,
    `password` char(80) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `user`(`user`),
    KEY `parent`(`parent`),
    CONSTRAINT `files_folders_ibfk_3` FOREIGN KEY (`user`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `files_folders_ibfk_4` FOREIGN KEY (`parent`) REFERENCES `files_folders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `galleries`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    `group` varchar(255) DEFAULT NULL,
    `order` int(11) DEFAULT NULL,
    `mainphoto` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name`(`name`),
    KEY `mainphoto`(`mainphoto`),
    CONSTRAINT `galleries_ibfk_1` FOREIGN KEY (`mainphoto`) REFERENCES `photos`(`id`) ON DELETE SET NULL) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `galleries_descriptions`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `gallery` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `description` text NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `gallery_language`(`gallery`, `language`),
    KEY `language`(`language`),
    CONSTRAINT `galleries_descriptions_ibfk_1` FOREIGN KEY (`gallery`) REFERENCES `galleries`(`id`) ON DELETE CASCADE,
    CONSTRAINT `galleries_descriptions_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `galleries_photos`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `gallery` int(11) NOT NULL,
    `photo` int(11) NOT NULL,
    `order` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `gallery_photo`(`gallery`, `photo`),
    KEY `gallery`(`gallery`),
    KEY `photo`(`photo`),
    CONSTRAINT `galleries_photos_ibfk_1` FOREIGN KEY (`gallery`) REFERENCES `galleries`(`id`) ON DELETE CASCADE,
    CONSTRAINT `galleries_photos_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `groups`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(40) character
    SET latin1 COLLATE latin1_general_ci NOT NULL,
    `description` varchar(255) DEFAULT NULL,
    `module` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `module`(`module`),
    CONSTRAINT `groups_ibfk_2` FOREIGN KEY (`module`) REFERENCES `modules`(`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `groups`(`id`, `name`, `description`, `module`)
    VALUES (2, 'admins', 'Vstup do administrátorského rozhrania', 1),
(6, 'all_permissions', 'Všetky administrátorské oprávnenia', 1),
(7, 'photos_admins', 'Správcovia fotografií a galérií', 1),
(8, 'pages_admins', 'Správcovia stránok', 1);


CREATE TABLE `languages`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `code` char(2) NOT NULL,
    `description` varchar(255) NOT NULL,
    `show` tinyint(1) NOT NULL,
    `time_format` varchar(20) NOT NULL,
    `date_format` varchar(20) NOT NULL,
    `number_dec_point` char(1) NOT NULL,
    `number_thousands_sep` char(1) NOT NULL,
    `currency` varchar(3) NOT NULL,
    `week_start` tinyint(4) NOT NULL DEFAULT 1,
    `locale` varchar(20) NOT NULL,
    PRIMARY KEY (`id`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `languages`(`id`, `code`, `description`, `show`, `time_format`, `date_format`, `number_dec_point`, `number_thousands_sep`, `currency`, `week_start`, `locale`)
    VALUES (1, 'sk', 'Slovenčina', 1, 'H:i', 'd. j. Y', ',', '-', '€', 1, 'sk_SK.utf8'),
(2, 'en', 'English', 1, 'H:i', 'd. j. Y', ',', '.', '€', 1, 'en_GB.utf8');


CREATE TABLE `metadata`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `language` int(11) NOT NULL,
    `key` varchar(255) NOT NULL,
    `value` text NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `language_key`(`language`, `key`),
    CONSTRAINT `metadata_ibfk_1` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `metadata`(`id`, `language`, `key`, `value`)
    VALUES (98, 1, 'website_name', ''),
(99, 1, 'website_long_name', ''),
(100, 1, 'website_description', '\r\nIplikátor je akupresúrna podložka, ktorá účinne pomáha pri mnohých zdravotných problémoch. Táto jednoduchá, ale geniálne navrhnutá podložka s ihličkami poskytuje úľavu pri bolesti chrbta, kĺbov, strese a svalovom napätí. Objavte terapeutickú podložku Iplikátor na relaxáciu, zlepšenie krvného obehu a celkového blahobytu.'),
(101, 1, 'website_keywords', ''),
(102, 2, 'website_name', ''),
(103, 2, 'website_long_name', ''),
(104, 2, 'website_description', ''),
(105, 2, 'website_keywords', '\r\n');


CREATE TABLE `modules`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    `disabled` tinyint(1) NOT NULL DEFAULT 0,
    `system` tinyint(1) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name`(`name`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `modules`(`id`, `name`, `disabled`, `system`)
    VALUES (1, 'Core', 0, 1),
(2, 'Pages', 0, 1),
(3, 'PhotoManager', 0, 1);


CREATE TABLE `pages`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `created` datetime NOT NULL,
    `updated` datetime NOT NULL,
    `mainphoto` int(11) DEFAULT NULL,
    `maingallery` int(11) DEFAULT NULL,
    `parent` int(11) DEFAULT NULL,
    `order` int(11) NOT NULL,
    `lft` int(11) DEFAULT NULL,
    `rgt` int(11) DEFAULT NULL,
    `level` int(11) DEFAULT NULL,
    `showlink` enum('hide', 'show', 'logged_in') DEFAULT NULL,
    `group` int(11) NOT NULL DEFAULT -1,
    `main` tinyint(1) DEFAULT NULL,
    `index` tinyint(1) DEFAULT NULL,
    `template` varchar(255) NOT NULL,
    `modify_lock` tinyint(1) NOT NULL DEFAULT 0,
    `route` varchar(255) DEFAULT NULL,
    `show_on_mainpage` tinyint(4) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `parent`(`parent`),
    KEY `mainphoto`(`mainphoto`),
    KEY `maingallery`(`maingallery`),
    CONSTRAINT `pages_ibfk_2` FOREIGN KEY (`parent`) REFERENCES `pages`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `pages_ibfk_5` FOREIGN KEY (`mainphoto`) REFERENCES `photos`(`id`) ON DELETE SET NULL,
    CONSTRAINT `pages_ibfk_6` FOREIGN KEY (`maingallery`) REFERENCES `galleries`(`id`) ON DELETE SET NULL) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `pages_contents`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `page` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `perex` text DEFAULT NULL,
    `content` mediumtext NOT NULL,
    `url` varchar(255) NOT NULL,
    `keywords` text DEFAULT NULL,
    `description` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `language_page`(`language`, `page`),
    UNIQUE KEY `language_url`(`language`, `url`),
    KEY `page`(`page`),
    CONSTRAINT `pages_contents_ibfk_1` FOREIGN KEY (`page`) REFERENCES `pages`(`id`) ON DELETE CASCADE,
    CONSTRAINT `pages_contents_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `photos`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `file` char(40) NOT NULL,
    `old_file` varchar(255) NOT NULL,
    `width` smallint(6) NOT NULL,
    `height` smallint(6) NOT NULL,
    `center_x` smallint(6) DEFAULT NULL,
    `center_y` smallint(6) DEFAULT NULL,
    `video` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `file`(`file`),
    UNIQUE KEY `old_file`(`old_file`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `photos_descriptions`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `photo` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `description` varchar(255) DEFAULT NULL,
    `long_description` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `language_photo`(`language`, `photo`),
    KEY `photo`(`photo`),
    CONSTRAINT `photos_descriptions_ibfk_1` FOREIGN KEY (`photo`) REFERENCES `photos`(`id`) ON DELETE CASCADE,
    CONSTRAINT `photos_descriptions_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `photos_hotspots`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `photo` int(11) NOT NULL,
    `x` mediumint(9) NOT NULL,
    `y` mediumint(9) NOT NULL,
    `videos` text character
    SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
    `icon` varchar(255) character
    SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `photo`(`photo`),
    KEY `category`(`icon`),
    CONSTRAINT `photos_hotspots_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `photos_hotspots_contents`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `hotspot` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `text` text DEFAULT NULL,
    `url` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `language_hotspot`(`language`, `hotspot`),
    KEY `hotspot`(`hotspot`),
    CONSTRAINT `photos_hotspots_contents_ibfk_1` FOREIGN KEY (`hotspot`) REFERENCES `photos_hotspots`(`id`) ON DELETE CASCADE,
    CONSTRAINT `photos_hotspots_contents_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `photos_hotspots_photos`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `hotspot` int(11) NOT NULL,
    `photo` int(11) NOT NULL,
    `order` mediumint(9) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `hotspot_photo`(`hotspot`, `photo`),
    KEY `photo`(`photo`),
    CONSTRAINT `photos_hotspots_photos_ibfk_1` FOREIGN KEY (`hotspot`) REFERENCES `photos_hotspots`(`id`) ON DELETE CASCADE,
    CONSTRAINT `photos_hotspots_photos_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;


CREATE TABLE `search_index`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `language` int(11) DEFAULT NULL,
    `object` int(11) NOT NULL,
    `type` varchar(255) NOT NULL,
    `type_priority` tinyint(4) NOT NULL,
    `object_date` datetime NOT NULL,
    `object_data` mediumblob NOT NULL,
    `data_1` text DEFAULT NULL,
    `data_2` text DEFAULT NULL,
    `data_3` text DEFAULT NULL,
    `data_4` text DEFAULT NULL,
    `data_5` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `language_object_type`(`language`, `object`, `type`),
    FULLTEXT KEY `data_1_data_2_data_3_data_4_data_5`(`data_1`, `data_2`, `data_3`, `data_4`, `data_5`)) ENGINE = MyISAM DEFAULT CHARSET = utf8;



CREATE TABLE `snippets`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name`(`name`)) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


CREATE TABLE `snippets_contents`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `snippet` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `content` mediumtext NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `snippet_language`(`snippet`, `language`),
    KEY `snippet`(`snippet`),
    KEY `language`(`language`),
    CONSTRAINT `snippets_contents_ibfk_4` FOREIGN KEY (`snippet`) REFERENCES `snippets`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `snippets_contents_ibfk_5` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


CREATE TABLE `users`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_name` varchar(255) NOT NULL,
    `password` char(80) NOT NULL,
    `allowed` tinyint(1) NOT NULL,
    `first_name` varchar(255) NOT NULL,
    `last_name` varchar(255) NOT NULL,
    `email` varchar(255) DEFAULT NULL,
    `photo` char(40) DEFAULT NULL,
    `preferred_language` int(11) DEFAULT NULL,
    `delete_lock` tinyint(1) NOT NULL DEFAULT 0,
    `address` text DEFAULT NULL,
    `web` varchar(255) DEFAULT NULL,
    `phone` varchar(255) DEFAULT NULL,
    `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(),
    `avatar` int(11) DEFAULT NULL,
    `extra_data_1` varchar(255) DEFAULT NULL,
    `extra_data_2` varchar(255) DEFAULT NULL,
    `extra_data_3` blob DEFAULT NULL,
    `extra_data_4` blob DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `user_name`(`user_name`),
    KEY `language`(`preferred_language`),
    KEY `avatar`(`avatar`),
    CONSTRAINT `users_ibfk_1` FOREIGN KEY (`preferred_language`) REFERENCES `languages`(`id`),
    CONSTRAINT `users_ibfk_2` FOREIGN KEY (`avatar`) REFERENCES `photos`(`id`) ON DELETE SET NULL) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `users`(`id`, `user_name`, `password`, `allowed`, `first_name`, `last_name`, `email`, `photo`, `preferred_language`, `delete_lock`, `address`, `web`, `phone`, `updated`, `avatar`, `extra_data_1`, `extra_data_2`, `extra_data_3`, `extra_data_4`)
    VALUES (1, 'admin', 'yJa#One1EMIzemiqIDIQUpEqa$iNyjoMy3aSi9oXcef8e10856258abe6fa56d08b6679dec6dcbd933', 1, 'Admin', 'Admin', 'admin@example.com', NULL, 1, 1, 'letná 40, košice', '',	'', '2025-01-07 20:31:08', NULL, NULL, NULL, NULL, NULL);


CREATE TABLE `users_description`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user` int(11) NOT NULL,
    `language` int(11) NOT NULL,
    `description` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `user_language`(`user`, `language`),
    KEY `language`(`language`),
    CONSTRAINT `users_description_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users`(`id`) ON DELETE CASCADE,
    CONSTRAINT `users_description_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `users_description`(`id`, `user`, `language`, `description`)
    VALUES (19, 1, 1, ''),
(20, 1, 2, '');


CREATE TABLE `users_groups`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user` int(11) NOT NULL,
    `group` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `user_group`(`user`, `group`),
    KEY `group`(`group`),
    CONSTRAINT `users_groups_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users`(`id`) ON DELETE CASCADE,
    CONSTRAINT `users_groups_ibfk_2` FOREIGN KEY (`group`) REFERENCES `groups`(`id`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO `users_groups`(`id`, `user`, `group`)
    VALUES (3, 1, 2),
(6, 1, 6),
(27, 1, 7),
(28, 1, 8);

-- 2025-03-29 20:24:19
