Projekt

Obecné

Profil

Stáhnout (127 KB) Statistiky
| Větev: | Tag: | Revize:
8baed187 Michal Kliment
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/

/**
* This upgrade is equal to one in 1.0.0~rc1 version
*
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
*/
$upgrade_equal_to['1.0.0~rc1'] = array
(
'1529', '1559', '1.0.0~beta5', '1.0.0~beta6', '1.0.0~beta7'
);

/**
* This DB upgrade unifies all previous updates to a single one update.
* If previous upgrades are already made the uprage is ignored.
* Thisis made by the upgrade_equal_to variable located also in this file.
*
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
*/
$upgrade_sql['1.0.0~rc1'] = array
(
"SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';",
"SET time_zone='+00:00';",
"/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;",
"/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;",
"/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;",
"/*!40101 SET NAMES utf8 */;",
"CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) DEFAULT NULL,
`name` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`account_attribute_id` int(11) NOT NULL,
`balance` double DEFAULT '0' COMMENT 'Account balance, value is updated with respect to transfers of account',
`comment` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`comments_thread_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `is_owned_by` (`member_id`),
KEY `comments_thread_id` (`comments_thread_id`),
KEY `account_attribute_id` (`account_attribute_id`),
KEY `balance` (`balance`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",
"CREATE TABLE IF NOT EXISTS `accounts_bank_accounts` (
`account_id` int(11) NOT NULL,
`bank_account_id` int(11) NOT NULL,
PRIMARY KEY (`account_id`,`bank_account_id`),
KEY `bank_account_id` (`bank_account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"CREATE TABLE IF NOT EXISTS `account_attributes` (
`id` int(11) NOT NULL DEFAULT '0',
`name` varchar(230) COLLATE utf8_czech_ci DEFAULT NULL,
`type` tinyint(4) DEFAULT NULL COMMENT 'aktivní, pasivní, daňový, nedaňový',
`kind` tinyint(4) DEFAULT NULL COMMENT 'rozvahový, výsledovkový, závěrkový, podrozvahový',
`activity` tinyint(4) DEFAULT NULL COMMENT 'hlavní/hospodářská činnost',
`track_balance` tinyint(4) DEFAULT NULL COMMENT 'true, false',
`line` tinyint(4) DEFAULT NULL COMMENT 'řádek plné výsledovky',
`line_short` tinyint(4) DEFAULT NULL COMMENT 'řádek zkrácené výsledovky',
`line_credits` tinyint(4) DEFAULT NULL COMMENT 'řádek pasiv',
`line_credits_short` tinyint(4) DEFAULT NULL COMMENT 'řádek zkrácených pasiv ',
`comment` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `account_attributes` (`id`, `name`, `type`, `kind`, `activity`, `track_balance`, `line`, `line_short`, `line_credits`, `line_credits_short`, `comment`) VALUES
(12000, 'Nehmotné výsledky výzkumu a vývoje', 42, 45, 0, 0, 2, 2, 0, 0, NULL),
(13000, 'Software', 42, 45, 0, 0, 3, 2, 0, 0, NULL),
(14000, 'Ocenitelná práva', 42, 45, 0, 0, 4, 2, 0, 0, NULL),
(18000, 'Drobný dlouhodobý nehmotný majetek', 42, 45, 0, 0, 5, 2, 0, 0, NULL),
(19000, 'Ostatní dlouhodobý nehmotný majetek', 42, 45, 0, 0, 6, 2, 0, 0, NULL),
(21000, 'Stavby', 42, 45, 0, 0, 12, 3, 0, 0, NULL),
(22000, 'Samostatné movité věci a soubory movitých věcí', 42, 45, 0, 0, 13, 3, 0, 0, NULL),
(25000, 'Pěstitelské celky trvalých porostů', 42, 45, 0, 0, 14, 3, 0, 0, NULL),
(26000, 'Základní stádo a tažná zvířata', 42, 45, 0, 0, 15, 3, 0, 0, NULL),
(28000, 'Drobný dlouhodobý hmotný majetek', 42, 45, 0, 0, 16, 3, 0, 0, NULL),
(29000, 'Ostatní dlouhodobý hmotný majetek', 42, 45, 0, 0, 17, 3, 0, 0, NULL),
(31000, 'Pozemky', 42, 45, 0, 0, 10, 3, 0, 0, NULL),
(32000, 'Umělecká díla, předměty a sbírky', 42, 45, 0, 0, 11, 3, 0, 0, NULL),
(41000, 'Nedokončený dlouhodobý nehmotný majetek', 42, 45, 0, 0, 7, 2, 0, 0, NULL),
(42000, 'Nedokončený dlouhodobý hmotný majetek', 42, 45, 0, 0, 18, 3, 0, 0, NULL),
(43000, 'Pořizovaný dlouhodobý finanční majetek', 42, 45, 0, 0, 27, 4, 0, 0, NULL),
(51000, 'Poskytnuté zálohy na dlouhodobý nehmotný majetek', 42, 45, 0, 0, 8, 2, 0, 0, NULL),
(52000, 'Poskytnuté zálohy na dlouhodobý hmotný majetek', 42, 45, 0, 0, 19, 3, 0, 0, NULL),
(61000, 'Podíly v ovládaných a řízených osobách', 42, 45, 0, 0, 21, 4, 0, 0, NULL),
(62000, 'Podíly v osobách pod podstatným vlivem', 42, 45, 0, 0, 22, 4, 0, 0, NULL),
(63000, 'Dluhové cenné papíry držené do splatnosti', 42, 45, 0, 0, 23, 4, 0, 0, NULL),
(66000, 'Půjčky organizačnm složkám', 42, 45, 0, 0, 24, 4, 0, 0, NULL),
(67000, 'Ostatní dlouhodobé půjčky', 42, 45, 0, 0, 25, 4, 0, 0, NULL),
(69000, 'Ostatní dlouhodobý finanční majetek', 42, 45, 0, 0, 26, 4, 0, 0, NULL),
(72000, 'Oprávky k nehmotným výsledkům výzkumu a vývoje', 42, 45, 0, 0, 29, 5, 0, 0, NULL),
(73000, 'Oprávky k softwaru', 42, 45, 0, 0, 30, 5, 0, 0, NULL),
(74000, 'Oprávky k ocenitelným právům', 42, 45, 0, 0, 31, 5, 0, 0, NULL),
(78000, 'Oprávky k drobnému dlouhodobému nehmotnému majetku', 42, 45, 0, 0, 32, 5, 0, 0, NULL),
(79000, 'Oprávky k ostatnímu dlouhodobému nehmotnému majetku', 42, 45, 0, 0, 33, 5, 0, 0, NULL),
(81000, 'Oprávky ke stavbám', 42, 45, 0, 0, 34, 5, 0, 0, NULL),
(82000, 'Oprávky k samost. movitým věcem a souborům movitých věcí', 42, 45, 0, 0, 35, 5, 0, 0, NULL),
(85000, 'Oprávky k pěstitelským celkům trvalých porostů', 42, 45, 0, 0, 36, 5, 0, 0, NULL),
(86000, 'Oprávky k základnímu stádu a tažným zvířatům', 42, 45, 0, 0, 37, 5, 0, 0, NULL),
(88000, 'Oprávky k drobnému dlouhodobému hmotnému majetku', 42, 45, 0, 0, 38, 5, 0, 0, NULL),
(89000, 'Oprávky k ostatnímu dlouhodobému hmotnému majetku', 42, 45, 0, 0, 39, 5, 0, 0, NULL),
(111000, 'Pořizovaný materiál', 42, 45, 0, 0, 0, 0, 0, 0, NULL),
(112000, 'Materiál na skladě', 42, 45, 0, 0, 42, 7, 0, 0, NULL),
(119000, 'Materiál na cestě', 42, 45, 0, 0, 43, 7, 0, 0, NULL),
(121000, 'Nedokončená výroba', 42, 45, 0, 0, 44, 7, 0, 0, NULL),
(122000, 'Polotovary vlastní výroby', 42, 45, 0, 0, 45, 7, 0, 0, NULL),
(123000, 'Výrobky', 42, 45, 0, 0, 46, 7, 0, 0, NULL),
(124000, 'Zvířata', 42, 45, 0, 0, 47, 7, 0, 0, NULL),
(131000, 'Pořizované zboží', 42, 45, 0, 0, 0, 0, 0, 0, NULL),
(132000, 'Zboží na skladě a v prodejnách', 42, 45, 0, 0, 48, 7, 0, 0, NULL),
(139000, 'Zboží na cestě', 42, 45, 0, 0, 49, 7, 0, 0, NULL),
(211000, 'Pokladna', 42, 45, 0, 0, 72, 9, 0, 0, NULL),
(213000, 'Ceniny', 42, 45, 0, 0, 73, 9, 0, 0, NULL),
(221000, 'Účty v bankách', 42, 45, 0, 0, 74, 9, 0, 0, NULL),
(221100, 'Účet kreditu', 42, 45, 0, 0, 74, 9, 0, 0, NULL),
(221101, 'Provozní účet', 42, 45, 0, 0, 74, 9, 0, 0, NULL),
(221102, 'Účet infrastruktury', 42, 45, 0, 0, 74, 9, 0, 0, NULL),
(221103, 'Projektový účet', 42, 45, 0, 0, 74, 9, 0, 0, NULL),
(231000, 'Krátkodobé bankovní úvěry', 28, 45, 0, 0, 123, 18, 0, 0, NULL),
(232000, 'Eskontní úvěry', 28, 45, 0, 0, 124, 18, 0, 0, NULL),
(241000, 'Emitované krátkodobé dluhopisy', 28, 45, 0, 0, 125, 18, 0, 0, NULL),
(249000, 'Ostatní krátkodobé finanční výpomoci', 28, 45, 0, 0, 127, 18, 0, 0, NULL),
(251000, 'Majetkové cenné papíry k obchodování', 42, 45, 0, 0, 75, 9, 0, 0, NULL),
(253000, 'Dluhové cenné papíry k obchodování', 42, 45, 0, 0, 76, 9, 0, 0, NULL),
(255000, 'Vlastní dluhopisy', 28, 45, 0, 0, 126, 18, 0, 0, NULL),
(256000, 'Ostatní cenné papíry ', 42, 45, 0, 0, 77, 9, 0, 0, NULL),
(259000, 'Pořizovaný krátkodobý finanční majetek', 42, 45, 0, 0, 78, 9, 0, 0, NULL),
(261000, 'Peníze na cestě', 42, 45, 0, 0, 79, 9, 0, 0, NULL),
(311000, 'Odběratelé', 42, 45, 0, 1, 52, 8, 0, 0, NULL),
(312000, 'Směnky k inkasu', 42, 45, 0, 0, 53, 8, 0, 0, NULL),
(313000, 'Pohledávky za eskontované cenné papíry', 42, 45, 0, 0, 54, 8, 0, 0, NULL),
(314000, 'Poskytnuté provozní zálohy a zálohy na zásoby', 42, 45, 0, 0, 50, 7, 0, 0, NULL),
(315000, 'Ostatní pohledávky', 42, 45, 0, 0, 56, 8, 0, 0, NULL),
(321000, 'Dodavatelé', 28, 45, 0, 1, 106, 18, 0, 0, NULL),
(322000, 'Směnky k úhradě', 28, 45, 0, 0, 107, 18, 0, 0, NULL),
(324000, 'Přijaté zálohy', 28, 45, 0, 0, 108, 18, 0, 0, NULL),
(325000, 'Ostatní závazky', 28, 45, 0, 0, 109, 18, 0, 0, NULL),
(331000, 'Zaměstnanci', 28, 45, 0, 0, 110, 18, 0, 0, NULL),
(333000, 'Ostatní závazky vůči zaměstnancům', 28, 45, 0, 0, 111, 18, 0, 0, NULL),
(335000, 'Pohledávky za zaměstnanci', 42, 45, 0, 0, 57, 8, 0, 0, NULL),
(336000, 'Zúčtování s institucemi sociál. zabezpečení a zdravot. pojištění', 28, 45, 0, 0, 58, 8, 112, 18, NULL),
(336001, 'Sociální pojištění', 28, 45, 0, 0, 58, 8, 112, 18, NULL),
(336002, 'Zdrav. pojištění VZP', 28, 45, 0, 0, 58, 8, 112, 18, NULL),
(336003, 'Zdrav. pojištění HUZP', 28, 45, 0, 0, 58, 8, 112, 18, NULL),
(341000, 'Daň z příjmů', 28, 45, 0, 0, 59, 8, 113, 18, NULL),
(342000, 'Ostatní přímé daně', 28, 45, 0, 0, 60, 8, 114, 18, NULL),
(342001, 'Daň z příjmů zaměstnanců zálohová', 28, 45, 0, 0, 60, 8, 114, 18, NULL),
(342002, 'Daň z příjmů zaměstnanců srážková', 28, 45, 0, 0, 60, 8, 114, 18, NULL),
(343000, 'Daň z přidané hodnoty', 28, 45, 0, 0, 61, 8, 115, 18, NULL),
(345000, 'Ostatní daně a poplatky', 28, 45, 0, 0, 62, 8, 116, 18, NULL),
(346000, 'Nároky na dotace a ost. zúčt. se státním rozpočtem', 28, 45, 0, 0, 63, 8, 117, 18, NULL),
(348000, 'Nároky na dotace a ost. zúčt. s rozpočtem územních celků', 28, 45, 0, 0, 64, 8, 118, 18, NULL),
(349000, 'Vyrovnávací účet pro DPH', 42, 45, 0, 0, 0, 0, 0, 0, NULL),
(358000, 'Pohledávky za účastníky sdružení', 42, 45, 0, 0, 65, 8, 0, 0, NULL),
(367000, 'Závazky z upsaných nesplacených cenných papírů a vkladů', 28, 45, 0, 0, 119, 18, 0, 0, NULL),
(368000, 'Závazky k účastníkům sdružení', 28, 45, 0, 0, 120, 18, 0, 0, NULL),
(373000, 'Pohledávky a závazky z pevných termínových operací', 28, 45, 0, 0, 66, 8, 121, 18, NULL),
(375000, 'Pohledávky z emitovaných dluhopisů', 42, 45, 0, 0, 67, 8, 0, 0, NULL),
(378000, 'Jiné pohledávky', 42, 45, 0, 0, 68, 8, 0, 0, NULL),
(379000, 'Jiné závazky', 28, 45, 0, 0, 122, 18, 0, 0, NULL),
(381000, 'Náklady příštích období', 42, 45, 0, 0, 81, 10, 0, 0, NULL),
(383000, 'Výdaje příštích období', 28, 45, 0, 0, 127, 19, 0, 0, NULL),
(384000, 'Výnosy příštích období', 28, 45, 0, 0, 127, 19, 0, 0, NULL),
(385000, 'Příjmy příštích období', 42, 45, 0, 0, 82, 10, 0, 0, NULL),
(386000, 'Kursové rozdíly aktivní', 42, 45, 0, 0, 83, 10, 0, 0, NULL),
(387000, 'Kursové rozdíly pasivní', 28, 45, 0, 0, 127, 19, 0, 0, NULL),
(388000, 'Dohadné účty aktivní', 42, 45, 0, 0, 69, 8, 0, 0, NULL),
(389000, 'Dohadné účty pasivní', 28, 45, 0, 0, 103, 17, 0, 0, NULL),
(391000, 'Opravná položka k pohledávkám', 42, 45, 0, 0, 70, 8, 0, 0, NULL),
(395000, 'Vnitřní zúčtování', 42, 45, 0, 0, 0, 0, 0, 0, NULL),
(396000, 'Spojovací účet při sdružení', 42, 45, 0, 0, 0, 0, 0, 0, NULL),
(501000, 'Spotřeba materiálu', 43, 48, 1, 0, 3, 2, 0, 0, NULL),
(501001, 'Spotřeba materiálu - SÍŤ', 43, 48, 1, 0, 3, 2, 0, 0, NULL),
(502000, 'Spotřeba energie', 43, 48, 1, 0, 4, 2, 0, 0, NULL),
(503000, 'Spotřeba ostatních neskladovatelných dodávek', 43, 48, 1, 0, 5, 2, 0, 0, NULL),
(504000, 'Prodané zboží', 43, 48, 1, 0, 6, 2, 0, 0, NULL),
(511000, 'Opravy a udržování', 43, 48, 1, 0, 8, 3, 0, 0, NULL),
(512000, 'Cestovné', 43, 48, 1, 0, 9, 3, 0, 0, NULL),
(513000, 'Náklady na reprezentaci', 44, 48, 1, 0, 10, 3, 0, 0, NULL),
(518000, 'Ostatní služby', 43, 48, 1, 0, 11, 3, 0, 0, NULL),
(521000, 'Mzdové náklady', 43, 48, 1, 0, 13, 4, 0, 0, NULL),
(521001, 'Mzdové náklady - HPP', 43, 48, 1, 0, 13, 4, 0, 0, NULL),
(521002, 'Mzdové náklady - dohody', 43, 48, 1, 0, 13, 4, 0, 0, NULL),
(524000, 'Zákonné sociální pojištění', 43, 48, 1, 0, 14, 4, 0, 0, NULL),
(524001, 'Sociální pojištění', 43, 48, 1, 0, 14, 4, 0, 0, NULL),
(524002, 'Zdravotní pojištění VZP', 43, 48, 1, 0, 14, 4, 0, 0, NULL),
(524003, 'Zdravotní pojištění HUZP', 43, 48, 1, 0, 14, 4, 0, 0, NULL),
(525000, 'Ostatní sociální pojištění', 44, 48, 1, 0, 15, 4, 0, 0, NULL),
(527000, 'Zákonné sociální náklady', 43, 48, 1, 0, 16, 4, 0, 0, NULL),
(528000, 'Ostatní sociální náklady', 44, 48, 1, 0, 17, 4, 0, 0, NULL),
(531000, 'Daň silniční', 43, 48, 1, 0, 19, 5, 0, 0, NULL),
(532000, 'Daň z nemovitostí', 43, 48, 1, 0, 20, 5, 0, 0, NULL),
(538000, 'Ostatní daně a poplatky', 43, 48, 1, 0, 21, 5, 0, 0, NULL),
(541000, 'Smluvní pokuty a úroky z prodlení', 43, 48, 1, 0, 23, 6, 0, 0, NULL),
(542000, 'Ostatní pokuty a penále', 44, 48, 1, 0, 24, 6, 0, 0, NULL),
(543000, 'Odpis nedobytné pohledávky', 44, 48, 1, 0, 25, 6, 0, 0, NULL),
(544000, 'Úroky', 43, 48, 1, 0, 26, 6, 0, 0, NULL),
(545000, 'Kursové ztráty', 43, 48, 1, 0, 27, 6, 0, 0, NULL),
(546000, 'Dary', 44, 48, 1, 0, 28, 6, 0, 0, NULL),
(548000, 'Manka a škody', 44, 48, 1, 0, 29, 6, 0, 0, NULL),
(549000, 'Jiné ostatní náklady', 43, 48, 1, 0, 30, 6, 0, 0, NULL),
(549001, 'Bankovní poplatky', 43, 48, 1, 0, 30, 6, 0, 0, NULL),
(549002, 'Jiné ostatní náklady (pojistné apod.)', 43, 48, 1, 0, 30, 6, 0, 0, NULL),
(549999, 'Jiné ostatní náklady - přeplatky', 44, 48, 1, 0, 30, 6, 0, 0, NULL),
(551000, 'Odpisy dlouhodobého nehmotného a hmotného majetku', 43, 48, 1, 0, 32, 7, 0, 0, NULL),
(551001, 'Odpisy dlouhodobého nehmotného a hmotného majetku', 43, 48, 1, 0, 32, 7, 0, 0, NULL),
(551002, 'Odpisy dlouhodobého nehmotného a hmotného majetku', 44, 48, 1, 0, 32, 7, 0, 0, NULL),
(552000, 'Zůstatková cena prodaného dlouh. nehmotného a hmotného majetku', 43, 48, 1, 0, 33, 7, 0, 0, NULL),
(553000, 'Prodané cenné papíry a podíly', 43, 48, 1, 0, 34, 7, 0, 0, NULL),
(554000, 'Prodaný materiál', 43, 48, 1, 0, 35, 7, 0, 0, NULL),
(556000, 'Tvorba rezerv', 44, 48, 1, 0, 36, 7, 0, 0, NULL),
(559000, 'Tvorba opravných položek', 44, 48, 1, 0, 37, 7, 0, 0, NULL),
(581000, 'Poskytnuté příspěvky zúčtované mezi organizačními složkami', 43, 48, 1, 0, 39, 8, 0, 0, NULL),
(582000, 'Poskytnuté členské příspěvky', 43, 48, 1, 0, 40, 8, 0, 0, NULL),
(591000, 'Daň z příjmů', 44, 48, 1, 0, 83, 127, 0, 0, NULL),
(595000, 'Dodatečné odvody daně z příjmů', 44, 48, 1, 0, 42, 9, 0, 0, NULL),
(601000, 'Tržby za vlastní výrobky', 43, 48, 1, 0, 46, 12, 0, 0, NULL),
(602001, 'Tržby z prodeje služeb KULTURA', 43, 48, 1, 0, 47, 12, 0, 0, NULL),
(602002, 'Tržby z prodeje služeb SÍŤ', 43, 48, 1, 0, 47, 12, 0, 0, NULL),
(604000, 'Tržby za prodané zboží', 43, 48, 1, 0, 48, 12, 0, 0, NULL),
(611000, 'Změna stavu zásob nedokončené výroby', 43, 48, 1, 0, 50, 13, 0, 0, NULL),
(612000, 'Změna stavu zásob polotovarů', 43, 48, 1, 0, 51, 13, 0, 0, NULL),
(613000, 'Změna stavu zásob výrobků', 43, 48, 1, 0, 52, 13, 0, 0, NULL),
(614000, 'Změna stavu zvířat', 43, 48, 1, 0, 53, 13, 0, 0, NULL),
(621000, 'Aktivace materiálu a zboží', 43, 48, 1, 0, 55, 14, 0, 0, NULL),
(622000, 'Aktivace vnitroorganizačních služeb', 43, 48, 1, 0, 56, 14, 0, 0, NULL),
(623000, 'Aktivace dlouhodobého nehmotného majetku', 43, 48, 1, 0, 57, 14, 0, 0, NULL),
(624000, 'Aktivace dlouhodobého hmotného majetku', 43, 48, 1, 0, 58, 14, 0, 0, NULL),
(641000, 'Smluvní pokuty a úroky z prodlení', 43, 48, 1, 0, 60, 15, 0, 0, NULL),
(642000, 'Ostatní pokuty a penále', 43, 48, 1, 0, 61, 15, 0, 0, NULL),
(643000, 'Platby za odepsané pohledávky', 43, 48, 1, 0, 62, 15, 0, 0, NULL),
(644000, 'Úroky', 43, 48, 1, 0, 63, 15, 0, 0, NULL),
(645000, 'Kursové zisky', 43, 48, 1, 0, 64, 15, 0, 0, NULL),
(648000, 'Zúčtování fondů', 43, 48, 1, 0, 65, 15, 0, 0, NULL),
(649000, 'Jiné ostatní výnosy', 43, 48, 1, 0, 66, 15, 0, 0, NULL),
(652000, 'Tržby z prodeje dlouhodobého nehmotného a hmotného majetku', 43, 48, 1, 0, 68, 16, 0, 0, NULL),
(653000, 'Tržby z prodeje cenných papírů a podílů', 43, 48, 1, 0, 69, 16, 0, 0, NULL),
(654000, 'Tržby z prodeje materiálu', 43, 48, 1, 0, 70, 16, 0, 0, NULL),
(655000, 'Výnosy z krátkodobého finančního majetku', 43, 48, 1, 0, 71, 16, 0, 0, NULL),
(656000, 'Zúčtování rezerv', 43, 48, 1, 0, 72, 16, 0, 0, NULL),
(657000, 'Výnosy z dlouhodobého finančního majetku', 43, 48, 1, 0, 73, 16, 0, 0, NULL),
(659000, 'Zúčtování opravných položek', 43, 48, 1, 0, 74, 16, 0, 0, NULL),
(681000, 'Přijaté příspěvky zúčtované mezi organizačními složkami', 43, 48, 1, 0, 76, 17, 0, 0, NULL),
(682000, 'Přijaté příspěvky (dary)', 43, 48, 1, 0, 77, 17, 0, 0, NULL),
(684000, 'Přijaté členské příspěvky', 43, 48, 1, 0, 78, 17, 0, 0, NULL),
(691000, 'Provozní dotace', 44, 48, 1, 0, 80, 18, 0, 0, NULL),
(901000, 'Vlastní jmění', 28, 45, 0, 0, 87, 13, 0, 0, NULL),
(911000, 'Fondy', 28, 45, 0, 0, 88, 13, 0, 0, NULL),
(921000, 'Oceňovací rozdíly z přecenění majetku a závazků', 28, 45, 0, 0, 89, 13, 0, 0, NULL),
(931000, 'Výsledek hospodaření ve schvalovacím řízení', 28, 45, 0, 0, 92, 127, 0, 0, NULL),
(932000, 'Nerozdělený zisk, neuhrazená ztráta minulých let', 28, 45, 0, 0, 93, 127, 0, 0, NULL),
(941000, 'Rezervy', 28, 45, 0, 0, 96, 16, 0, 0, NULL),
(951000, 'Dlouhodobé bankovní úvěry', 28, 45, 0, 0, 98, 17, 0, 0, NULL),
(953000, 'Emitované dluhopisy', 28, 45, 0, 0, 99, 17, 0, 0, NULL),
(954000, 'Závazky z pronájmu', 28, 45, 0, 0, 100, 17, 0, 0, NULL),
(955000, 'Přijaté dlouhodobé zálohy', 28, 45, 0, 0, 101, 17, 0, 0, NULL),
(958000, 'Dlouhodobé směnky k úhradě', 28, 45, 0, 0, 102, 17, 0, 0, NULL),
(959000, 'Ostatní dlouhodobé závazky', 28, 45, 0, 0, 104, 17, 0, 0, NULL),
(961000, 'Počáteční účet rozvažný', 0, 47, 0, 0, 0, 0, 0, 0, NULL),
(962000, 'Konečný účet rozvažný', 0, 47, 0, 0, 0, 0, 0, 0, NULL),
(963000, 'Účet výsledku hospodaření', 0, 47, 0, 0, 0, 0, 0, 0, NULL);",
"CREATE TABLE IF NOT EXISTS `acl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`note` text COLLATE utf8_czech_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=80 ;",
"INSERT INTO `acl` (`id`, `note`) VALUES
(38, 'Adminstratori mohou spravovat vsechny cleny a uzivatele, presmerovani a zalohovani.'),
(40, 'Radni clenove vidi svoje ucty (accounts) a transakce na nich, ale nemohou je editovat. Mohou ale tvorit nove transakce pro casti sveho kreditu na ucty jinych clenu.'),
(42, 'Regular members can see unidentified transfers.'),
(43, 'Radni clen vidi svuj ucet'),
(44, 'All users can edit their usernames and passwords.'),
(47, 'Necertifikovani technici mohou editovat a pridavat vlastni zarizeni.'),
(49, 'Certifikovani technici mohou editovat a pridavat vsechna zarizeni, spravovat presmerovani a zalohovani.'),
(51, 'Spravni rada muze spravovat vse u clenu a uzivatelu.'),
(52, 'Spravni rada ma pravo videt zarizeni, ale nema prave je editovat.'),
(54, 'Predseda a jednatel schvaluji prace.'),
(56, 'Revizni komise vidi vse, editovat vsak muze velke prd :-)'),
(57, 'Administratori systemu mohou spravovat zneni prekladu a veskere nastaveni.'),
(58, 'Certifikovani technici mohou prohlizet, pridavat a editovat jen nektere polozky u clenu a uzivatelu'),
(59, 'Certifikovani technici maji pravo videt a pridavat datum vstupu, login, telefon a heslo.'),
(60, 'Revizni komise muze editovat pouze informace o sobe, nikoliv vsak zarizeni.'),
(61, 'Administratori mohou posilat e-maily z freenetisu'),
(62, 'Vsichni clenove sdruzeni nemohou potvrzovat sve vlastni prace.'),
(63, 'Administratori a spravni rada smi potvrzovat prace.'),
(64, 'Radni clenove si mohou vytvaret, editovat a mazat sve prace.'),
(65, 'Vsicchni clenove vidi jen sve vlastni aplikacni heslo.'),
(66, 'Administratori mohou editovat aplikacni heslo vsem, nesmi je ale videt'),
(67, 'Voip admins are allowed to administrate Voips.'),
(68, 'First-degree certified engineers can only view admins of devices; they cannot edit them.'),
(69, 'Fourth-degree certified engineers can edit admins od devices.'),
(70, 'Fifth-degress certified engineers can view logins and passwords of devices.'),
(71, 'Sixth-degrees certified engineers can add and edit logins and passwords of devices.'),
(72, 'Owners of company telephones can see their phone invoices, and edit their phone invoices dumps'),
(73, 'Owners of company telephones can see their private phone contacts, edit and remove them'),
(74, 'Regulars members can add, update and delete their contacts'),
(75, 'Engineers can view tariffs of members, but they cannot edit them.'),
(76, 'Engineers can view all comments, they can add/edit/delete own comments.'),
(77, 'All members can only edit their allowed subnets.'),
(78, 'Tenth-degree certified engineers and admins can manage clouds.'),
(79, 'Administrators can administer variable symbols');",
"CREATE TABLE IF NOT EXISTS `aco` (
`id` int(11) NOT NULL DEFAULT '0',
`value` varchar(240) COLLATE utf8_czech_ci NOT NULL,
`name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `section_value_value_aco` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `aco` (`id`, `value`, `name`) VALUES
(14, 'view_all', 'Viewing of all records'),
(15, 'edit_all', 'Editing of all records'),
(16, 'new_all', 'Creating of all records'),
(17, 'view_own', 'Viewing of own records'),
(18, 'edit_own', 'Editing of own records'),
(19, 'new_own', 'Creating of own records'),
(20, 'delete_all', 'Deleting of all records'),
(21, 'delete_own', 'Deleting of own records'),
(33, 'write_email', 'Send email'),
(34, 'confirm_all', 'Confirming of all records'),
(35, 'confirm_own', 'Confirming of own records');",
"CREATE TABLE IF NOT EXISTS `aco_map` (
`acl_id` int(11) NOT NULL DEFAULT '0',
`value` varchar(230) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`acl_id`,`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `aco_map` (`acl_id`, `value`) VALUES
(38, 'delete_all'),
(38, 'edit_all'),
(38, 'new_all'),
(38, 'view_all'),
(40, 'new_own'),
(40, 'view_own'),
(42, 'view_all'),
(43, 'view_own'),
(44, 'edit_own'),
(47, 'delete_own'),
(47, 'edit_own'),
(47, 'new_own'),
(47, 'view_own'),
(49, 'delete_all'),
(49, 'edit_all'),
(49, 'new_all'),
(49, 'view_all'),
(51, 'delete_all'),
(51, 'edit_all'),
(51, 'new_all'),
(51, 'view_all'),
(52, 'view_all'),
(54, 'delete_all'),
(54, 'edit_all'),
(54, 'new_all'),
(54, 'view_all'),
(56, 'view_all'),
(57, 'delete_all'),
(57, 'edit_all'),
(57, 'new_all'),
(57, 'view_all'),
(58, 'edit_all'),
(58, 'new_all'),
(58, 'view_all'),
(59, 'new_all'),
(59, 'view_all'),
(60, 'delete_own'),
(60, 'edit_own'),
(60, 'new_own'),
(60, 'view_own'),
(61, 'write_email'),
(62, 'confirm_own'),
(63, 'delete_own'),
(63, 'edit_own'),
(63, 'new_own'),
(63, 'view_all'),
(63, 'view_own'),
(64, 'delete_own'),
(64, 'edit_own'),
(64, 'new_own'),
(64, 'view_own'),
(65, 'view_own'),
(66, 'edit_all'),
(67, 'delete_all'),
(67, 'edit_all'),
(67, 'new_all'),
(67, 'view_all'),
(68, 'view_all'),
(69, 'delete_all'),
(69, 'edit_all'),
(69, 'new_all'),
(69, 'view_all'),
(70, 'view_all'),
(71, 'delete_all'),
(71, 'edit_all'),
(71, 'new_all'),
(71, 'view_all'),
(72, 'edit_own'),
(72, 'view_own'),
(73, 'delete_own'),
(73, 'edit_own'),
(73, 'new_own'),
(73, 'view_own'),
(74, 'delete_own'),
(74, 'edit_own'),
(74, 'new_own'),
(75, 'view_all'),
(76, 'delete_own'),
(76, 'edit_own'),
(76, 'new_all'),
(76, 'view_all'),
(77, 'edit_own'),
(78, 'delete_all'),
(78, 'edit_all'),
(78, 'new_all'),
(78, 'view_all'),
(79, 'delete_all'),
(79, 'edit_all'),
(79, 'new_all'),
(79, 'view_all');",
"CREATE TABLE IF NOT EXISTS `address_points` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`country_id` smallint(6) NOT NULL,
`town_id` int(11) NOT NULL,
`street_id` int(11) DEFAULT NULL,
`street_number` varchar(50) COLLATE utf8_czech_ci DEFAULT NULL,
`gps` point DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `street_id` (`street_id`),
KEY `town_id` (`town_id`),
KEY `country_id` (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",
"CREATE TABLE IF NOT EXISTS `allowed_subnets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`subnet_id` int(11) NOT NULL,
`enabled` tinyint(1) NOT NULL DEFAULT '1',
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `subnet_id` (`subnet_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",
"CREATE TABLE IF NOT EXISTS `allowed_subnets_counts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`count` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",
"CREATE TABLE IF NOT EXISTS `approval_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`comment` mediumtext COLLATE utf8_czech_ci NOT NULL,
`state` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;",
"INSERT INTO `approval_templates` (`id`, `name`, `comment`, `state`) VALUES
(1, 'Default', 'Výchozí hlasovací šablona podle směrnic o.s. UnArt', 1);",
"CREATE TABLE IF NOT EXISTS `approval_template_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`approval_template_id` int(11) DEFAULT NULL,
`approval_type_id` int(11) NOT NULL,
`priority` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `approval_template_id` (`approval_template_id`),
KEY `approval_type_id` (`approval_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;",
"INSERT INTO `approval_template_items` (`id`, `approval_template_id`, `approval_type_id`, `priority`) VALUES
(1, 1, 1, 0),
(2, 1, 2, 1);",
"CREATE TABLE IF NOT EXISTS `approval_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`comment` mediumtext COLLATE utf8_czech_ci NOT NULL,
`type` int(11) NOT NULL,
`majority_percent` int(11) NOT NULL,
`aro_group_id` int(11) NOT NULL,
`interval` datetime NOT NULL,
`default_vote` tinyint(1) DEFAULT NULL,
`min_suggest_amount` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;",
"INSERT INTO `approval_types` (`id`, `name`, `comment`, `type`, `majority_percent`, `aro_group_id`, `interval`, `default_vote`, `min_suggest_amount`) VALUES
(1, 'Správní rada', 'Výchozí hlasovací typ pro hlasování Správní rady', 1, 51, 25, '0000-00-00 00:00:00', NULL, 0),
(2, 'Revizní komise', 'Výchozí hlasovací typ pro hlasování Revizní komise.', 1, 51, 24, '0000-00-01 00:00:00', NULL, 5000);",
"CREATE TABLE IF NOT EXISTS `aro_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`lft` int(11) NOT NULL DEFAULT '0',
`rgt` int(11) NOT NULL DEFAULT '0',
`name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`value` varchar(255) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`,`value`),
UNIQUE KEY `value_aro_groups` (`value`),
KEY `parent_id_aro_groups` (`parent_id`),
KEY `lft_rgt_aro_groups` (`lft`,`rgt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=45 ;",
"INSERT INTO `aro_groups` (`id`, `parent_id`, `lft`, `rgt`, `name`, `value`) VALUES
(21, 0, 1, 40, 'All', 'all'),
(22, 21, 2, 37, 'Regular members', 'regular_members'),
(23, 21, 38, 39, 'Registered applicants', 'registered_applicants'),
(24, 22, 4, 4, 'Auditing comittee', 'auditing_comittee'),
(25, 22, 5, 8, 'Executive counsil', 'executive_counsil'),
(26, 22, 9, 32, 'Engineers', 'engineers'),
(28, 25, 6, 7, 'Chairman and agent', 'chairman_and_agent'),
(29, 26, 10, 31, 'First-degree certified engineers', 'first_degree_certified_engineers'),
(32, 22, 33, 34, 'System administrators', 'admins'),
(33, 22, 35, 35, 'Users of regular members', 'users'),
(34, 29, 29, 30, 'VoIP admins', 'voip_admins'),
(35, 29, 11, 28, 'Second-degree certified engineers', 'second_degree_certified_engineers'),
(36, 35, 12, 27, 'Third-degree certified engineers', 'third_degree_certified_engineers'),
(37, 36, 13, 26, 'Fourth-degree certified engineers', 'fourth_degree_certified_engineers'),
(38, 37, 14, 25, 'Fifth-degree certified engineers', 'fifth_degree_certified_engineers'),
(39, 38, 15, 24, 'Sixth-degree certified engineers', 'sixth_degree_certified_engineers'),
(40, 39, 16, 23, 'Seventh-degree certified engineers', 'seventh_degree_certified_engineers'),
(41, 40, 17, 22, 'Eighth-degree certified engineers', 'eighth_degree_certified_engineers'),
(42, 41, 18, 21, 'Nineth-degree certified engineers', 'nineth_degree_certified_engineers'),
(43, 42, 19, 20, 'Tenth-degree certified engineers', 'tenth_degree_certified_engineers'),
(44, 22, 3, 36, 'Owners of company telephones', 'telephonists');",
"CREATE TABLE IF NOT EXISTS `aro_groups_map` (
`acl_id` int(11) NOT NULL DEFAULT '0',
`group_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`acl_id`,`group_id`),
KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`) VALUES
(40, 22),
(42, 22),
(43, 22),
(44, 22),
(62, 22),
(64, 22),
(65, 22),
(73, 22),
(74, 22),
(77, 22),
(56, 24),
(60, 24),
(63, 24),
(51, 25),
(52, 25),
(63, 25),
(47, 26),
(54, 28),
(49, 29),
(58, 29),
(59, 29),
(68, 29),
(75, 29),
(76, 29),
(38, 32),
(57, 32),
(61, 32),
(66, 32),
(78, 32),
(79, 32),
(67, 34),
(69, 37),
(70, 38),
(71, 39),
(78, 43),
(72, 44);",
"CREATE TABLE IF NOT EXISTS `axo` (
`id` int(11) NOT NULL DEFAULT '0',
`section_value` varchar(240) COLLATE utf8_czech_ci NOT NULL DEFAULT '0',
`value` varchar(240) COLLATE utf8_czech_ci NOT NULL,
`name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `section_value_value_axo` (`section_value`,`value`),
KEY `value` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`) VALUES
(15, 'Registration_Controller', 'name', 'Name'),
(16, 'Registration_Controller', 'surname', 'Surname'),
(17, 'Registration_Controller', 'street', 'Street'),
(20, 'Members_Controller', 'comment', 'Comment'),
(21, 'Members_Controller', 'entrance_date', 'Entrance date'),
(22, 'Members_Controller', 'qos_ceil', 'QoS ceil'),
(23, 'Members_Controller', 'qos_rate', 'QoS rate'),
(55, 'Accounts_Controller', 'invoices', 'Invoices'),
(91, 'Members_Controller', 'members', 'Members'),
(92, 'Users_Controller', 'additional_contacts', 'Additional contacts'),
(93, 'Users_Controller', 'users', 'Users'),
(95, 'Accounts_Controller', 'transfers', 'Transfers'),
(96, 'Accounts_Controller', 'accounts', 'Accounts'),
(97, 'Users_Controller', 'login', 'Login'),
(98, 'Members_Controller', 'name', 'Name'),
(100, 'Members_Controller', 'type', 'Type'),
(101, 'Users_Controller', 'name', 'Name'),
(102, 'Users_Controller', 'surname', 'Surname'),
(103, 'Members_Controller', 'address', 'Address'),
(104, 'Users_Controller', 'phone', 'Phone'),
(105, 'Users_Controller', 'email', 'E-mail'),
(106, 'Members_Controller', 'currentcredit', 'Current credit'),
(107, 'Members_Controller', 'en_fee', 'Entrance fee'),
(108, 'Members_Controller', 'en_fee_left', 'Entrance fee left'),
(109, 'Members_Controller', 'debit', 'Debit'),
(111, 'Users_Controller', 'work', 'Work'),
(112, 'Users_Controller', 'comment', 'Comment'),
(113, 'Users_Controller', 'password', 'Password'),
(115, 'Devices_Controller', 'devices', 'Devices'),
(116, 'Devices_Controller', 'admin', 'Admin'),
(117, 'Devices_Controller', 'iface', 'Interface'),
(118, 'Devices_Controller', 'port', 'Port'),
(119, 'Devices_Controller', 'ip_address', 'IP address'),
(120, 'Devices_Controller', 'vlan_iface', 'VLAN interface'),
(121, 'Devices_Controller', 'segment', 'Segment'),
(122, 'Devices_Controller', 'vlan', 'VLAN'),
(123, 'Devices_Controller', 'subnet', 'Subnet'),
(124, 'Members_Controller', 'registration', 'Registration'),
(126, 'Translations_Controller', 'translation', 'Translation'),
(127, 'Settings_Controller', 'system', 'System'),
(128, 'Users_Controller', 'member', 'Member'),
(129, 'Members_Controller', 'membership_interrupts', 'Membership interrupts'),
(130, 'Settings_Controller', 'fees', 'Fees'),
(131, 'Settings_Controller', 'enum_types', 'Enum types'),
(132, 'Members_Controller', 'organization_id', 'Organization identifier'),
(133, 'Members_Controller', 'leaving_date', 'Leaving date'),
(134, 'Accounts_Controller', 'bank_transfers', 'Bank transfers'),
(135, 'Accounts_Controller', 'bank_accounts', 'Bank accounts'),
(136, 'Accounts_Controller', 'unidentified_transfers', 'Unidentified transfers'),
(137, 'Devices_Controller', 'wireless_setting', 'Wireless setting'),
(138, 'Devices_Controller', 'main_engineer', 'Main engineer'),
(139, 'Devices_Controller', 'engineer', 'Engineer'),
(140, 'Address_points_Controller', 'address_point', 'Address point'),
(141, 'Members_Controller', 'var_sym', 'Variable symbol'),
(142, 'Address_points_Controller', 'town', 'Town'),
(143, 'Address_points_Controller', 'street', 'Street'),
(144, 'Members_Controller', 'redirect', 'Redirection of member'),
(145, 'Devices_Controller', 'redirect', 'Redirection of subnet'),
(146, 'VoIP_Controller', 'voip', 'VoIP'),
(147, 'VoIP_Controller', 'voip_password', 'VoIP password'),
(148, 'Devices_Controller', 'tools', 'Tools'),
(149, 'Users_Controller', 'application_password', 'Application password'),
(150, 'Members_Controller', 'locked', 'Locked account'),
(151, 'Redirection_Controller', 'redirection', 'Redirection'),
(152, 'Backup_Controller', 'backup', 'Backup'),
(153, 'Members_Controller', 'user_id', 'User who added member to system'),
(154, 'Messages_Controller', 'message', 'Message used for redirection'),
(155, 'Messages_Controller', 'ip_address', 'Redirection of single IP address'),
(156, 'Messages_Controller', 'member', 'Redirection of IP addresses of member'),
(157, 'Messages_Controller', 'subnet', 'Redirection of IP addresses in subnet'),
(158, 'Messages_Controller', 'subnet_enabled', 'Flag for enabling redirection mechanism on subnet'),
(159, 'Votes_Controller', 'work', 'Approval of work'),
(160, 'approval', 'templates', 'Approval templates'),
(161, 'approval', 'template_items', 'Approval template items'),
(162, 'approval', 'types', 'Approval types'),
(163, 'Accounts_Controller', 'bank_statements', 'Bank statements'),
(164, 'Phone_invoices_Controller', 'invoices', 'Invoices'),
(165, 'Phone_invoices_Controller', 'lock', 'Lock'),
(166, 'Phone_invoices_Controller', 'pay', 'Pay'),
(167, 'Phone_invoices_Controller', 'details', 'Details'),
(168, 'Phone_invoices_Controller', 'dumps', 'Dumps'),
(169, 'Private_phone_contacts_Controller', 'contacts', 'contacts'),
(170, 'Phone_invoices_Controller', 'mail_warning', 'Mail warning'),
(171, 'Members_Controller', 'fees', 'Member''s fees'),
(172, 'Ulogd_Controller', 'ip_address', 'IP address'),
(173, 'Ulogd_Controller', 'member', 'Member'),
(174, 'Comments_Controller', 'works', ''),
(175, 'Devices_Controller', 'allowed_subnet', 'Allowed subnet'),
(176, 'Users_Controller', 'keys', 'Keys (SSH)'),
(177, 'Clouds_Controller', 'clouds', 'Clouds'),
(178, 'Variable_Symbols_Controller', 'variable_symbols', 'Variable symbols');",
"CREATE TABLE IF NOT EXISTS `axo_map` (
`acl_id` int(11) NOT NULL DEFAULT '0',
`section_value` varchar(230) COLLATE utf8_czech_ci NOT NULL DEFAULT '0',
`value` varchar(230) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`acl_id`,`section_value`,`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES
(38, 'Accounts_Controller', 'accounts'),
(38, 'Accounts_Controller', 'bank_accounts'),
(38, 'Accounts_Controller', 'bank_statements'),
(38, 'Accounts_Controller', 'bank_transfers'),
(38, 'Accounts_Controller', 'invoices'),
(38, 'Accounts_Controller', 'transfers'),
(38, 'Accounts_Controller', 'unidentifed_transfers'),
(38, 'Accounts_Controller', 'unidentified_transfers'),
(38, 'Address_points_Controller', 'address_point'),
(38, 'Address_points_Controller', 'street'),
(38, 'Address_points_Controller', 'town'),
(38, 'approval', 'template_items'),
(38, 'approval', 'templates'),
(38, 'approval', 'types'),
(38, 'Backup_Controller', 'backup'),
(38, 'Comments_Controller', 'works'),
(38, 'Devices_Controller', 'admin'),
(38, 'Devices_Controller', 'allowed_subnet'),
(38, 'Devices_Controller', 'devices'),
(38, 'Devices_Controller', 'engineer'),
(38, 'Devices_Controller', 'iface'),
(38, 'Devices_Controller', 'ip_address'),
(38, 'Devices_Controller', 'login'),
(38, 'Devices_Controller', 'main_engineer'),
(38, 'Devices_Controller', 'password'),
(38, 'Devices_Controller', 'port'),
(38, 'Devices_Controller', 'redirect'),
(38, 'Devices_Controller', 'segment'),
(38, 'Devices_Controller', 'subnet'),
(38, 'Devices_Controller', 'tools'),
(38, 'Devices_Controller', 'vlan'),
(38, 'Devices_Controller', 'vlan_iface'),
(38, 'Devices_Controller', 'wireless_setting'),
(38, 'Members_Controller', 'address'),
(38, 'Members_Controller', 'comment'),
(38, 'Members_Controller', 'currentcredit'),
(38, 'Members_Controller', 'debit'),
(38, 'Members_Controller', 'en_fee'),
(38, 'Members_Controller', 'en_fee_left'),
(38, 'Members_Controller', 'entrance_date'),
(38, 'Members_Controller', 'fees'),
(38, 'Members_Controller', 'leaving_date'),
(38, 'Members_Controller', 'locked'),
(38, 'Members_Controller', 'members'),
(38, 'Members_Controller', 'membership_interrupts'),
(38, 'Members_Controller', 'name'),
(38, 'Members_Controller', 'organization_id'),
(38, 'Members_Controller', 'qos_ceil'),
(38, 'Members_Controller', 'qos_rate'),
(38, 'Members_Controller', 'redirect'),
(38, 'Members_Controller', 'registration'),
(38, 'Members_Controller', 'type'),
(38, 'Members_Controller', 'user_id'),
(38, 'Members_Controller', 'var_sym'),
(38, 'Messages_Controller', 'ip_address'),
(38, 'Messages_Controller', 'member'),
(38, 'Messages_Controller', 'message'),
(38, 'Messages_Controller', 'subnet'),
(38, 'Messages_Controller', 'subnet_enabled'),
(38, 'Phone_invoices_Controller', 'details'),
(38, 'Phone_invoices_Controller', 'dumps'),
(38, 'Phone_invoices_Controller', 'invoices'),
(38, 'Phone_invoices_Controller', 'lock'),
(38, 'Phone_invoices_Controller', 'mail_warning'),
(38, 'Phone_invoices_Controller', 'pay'),
(38, 'Redirection_Controller', 'redirection'),
(38, 'Ulogd_Controller', 'ip_address'),
(38, 'Ulogd_Controller', 'member'),
(38, 'Users_Controller', 'additional_contacts'),
(38, 'Users_Controller', 'comment'),
(38, 'Users_Controller', 'email'),
(38, 'Users_Controller', 'keys'),
(38, 'Users_Controller', 'login'),
(38, 'Users_Controller', 'member'),
(38, 'Users_Controller', 'name'),
(38, 'Users_Controller', 'password'),
(38, 'Users_Controller', 'phone'),
(38, 'Users_Controller', 'surname'),
(38, 'Users_Controller', 'users'),
(38, 'Users_Controller', 'work'),
(38, 'VoIP_Controller', 'voip'),
(38, 'VoIP_Controller', 'voip_password'),
(40, 'Accounts_Controller', 'accounts'),
(40, 'Accounts_Controller', 'transfers'),
(40, 'Users_Controller', 'login'),
(40, 'Users_Controller', 'users'),
(40, 'VoIP_Controller', 'voip'),
(42, 'Accounts_Controller', 'unidentified_transfers'),
(43, 'Devices_Controller', 'admin'),
(43, 'Devices_Controller', 'devices'),
(43, 'Devices_Controller', 'iface'),
(43, 'Devices_Controller', 'ip_address'),
(43, 'Devices_Controller', 'port'),
(43, 'Members_Controller', 'address'),
(43, 'Members_Controller', 'currentcredit'),
(43, 'Members_Controller', 'debit'),
(43, 'Members_Controller', 'en_fee'),
(43, 'Members_Controller', 'en_fee_left'),
(43, 'Members_Controller', 'entrance_date'),
(43, 'Members_Controller', 'fees'),
(43, 'Members_Controller', 'members'),
(43, 'Members_Controller', 'name'),
(43, 'Users_Controller', 'additional_contacts'),
(43, 'Users_Controller', 'email'),
(43, 'Users_Controller', 'login'),
(43, 'Users_Controller', 'name'),
(43, 'Users_Controller', 'phone'),
(43, 'Users_Controller', 'surname'),
(43, 'Users_Controller', 'users'),
(43, 'Users_Controller', 'work'),
(44, 'Users_Controller', 'application_password'),
(44, 'Users_Controller', 'login'),
(44, 'Users_Controller', 'password'),
(44, 'Users_Controller', 'users'),
(44, 'VoIP_Controller', 'voip_password'),
(47, 'Devices_Controller', 'admin'),
(47, 'Devices_Controller', 'devices'),
(47, 'Devices_Controller', 'iface'),
(47, 'Devices_Controller', 'ip_address'),
(47, 'Devices_Controller', 'port'),
(47, 'Devices_Controller', 'segment'),
(47, 'Devices_Controller', 'subnet'),
(47, 'Devices_Controller', 'vlan'),
(47, 'Devices_Controller', 'vlan_iface'),
(47, 'Devices_Controller', 'wireless_setting'),
(49, 'Backup_Controller', 'backup'),
(49, 'Devices_Controller', 'devices'),
(49, 'Devices_Controller', 'engineer'),
(49, 'Devices_Controller', 'iface'),
(49, 'Devices_Controller', 'ip_address'),
(49, 'Devices_Controller', 'port'),
(49, 'Devices_Controller', 'segment'),
(49, 'Devices_Controller', 'subnet'),
(49, 'Devices_Controller', 'tools'),
(49, 'Devices_Controller', 'vlan'),
(49, 'Devices_Controller', 'vlan_iface'),
(49, 'Devices_Controller', 'wireless_setting'),
(49, 'Redirection_Controller', 'redirection'),
(49, 'Ulogd_Controller', 'ip_address'),
(49, 'Ulogd_Controller', 'member'),
(49, 'Users_Controller', 'work'),
(51, 'Accounts_Controller', 'accounts'),
(51, 'Accounts_Controller', 'bank_accounts'),
(51, 'Accounts_Controller', 'bank_statements'),
(51, 'Accounts_Controller', 'bank_transfers'),
(51, 'Accounts_Controller', 'invoices'),
(51, 'Accounts_Controller', 'transfers'),
(51, 'Accounts_Controller', 'unidentifed_transfers'),
(51, 'Accounts_Controller', 'unidentified_transfers'),
(51, 'Address_points_Controller', 'address_point'),
(51, 'Address_points_Controller', 'street'),
(51, 'Address_points_Controller', 'town'),
(51, 'Devices_Controller', 'admin'),
(51, 'Devices_Controller', 'engineer'),
(51, 'Devices_Controller', 'main_engineer'),
(51, 'Devices_Controller', 'redirect'),
(51, 'Members_Controller', 'address'),
(51, 'Members_Controller', 'comment'),
(51, 'Members_Controller', 'currentcredit'),
(51, 'Members_Controller', 'debit'),
(51, 'Members_Controller', 'en_fee'),
(51, 'Members_Controller', 'en_fee_left'),
(51, 'Members_Controller', 'entrance_date'),
(51, 'Members_Controller', 'fees'),
(51, 'Members_Controller', 'leaving_date'),
(51, 'Members_Controller', 'locked'),
(51, 'Members_Controller', 'members'),
(51, 'Members_Controller', 'membership_interrupts'),
(51, 'Members_Controller', 'name'),
(51, 'Members_Controller', 'organization_id'),
(51, 'Members_Controller', 'qos_ceil'),
(51, 'Members_Controller', 'qos_rate'),
(51, 'Members_Controller', 'redirect'),
(51, 'Members_Controller', 'registration'),
(51, 'Members_Controller', 'type'),
(51, 'Members_Controller', 'user_id'),
(51, 'Members_Controller', 'var_sym'),
(51, 'Messages_Controller', 'ip_address'),
(51, 'Messages_Controller', 'member'),
(51, 'Messages_Controller', 'message'),
(51, 'Messages_Controller', 'subnet'),
(51, 'Messages_Controller', 'subnet_enabled'),
(51, 'Users_Controller', 'additional_contacts'),
(51, 'Users_Controller', 'comment'),
(51, 'Users_Controller', 'email'),
(51, 'Users_Controller', 'login'),
(51, 'Users_Controller', 'name'),
(51, 'Users_Controller', 'password'),
(51, 'Users_Controller', 'phone'),
(51, 'Users_Controller', 'surname'),
(51, 'Users_Controller', 'users'),
(51, 'Users_Controller', 'work'),
(52, 'Accounts_Controller', 'bank_statements'),
(52, 'Devices_Controller', 'admin'),
(52, 'Devices_Controller', 'devices'),
(52, 'Devices_Controller', 'iface'),
(52, 'Devices_Controller', 'ip_address'),
(52, 'Devices_Controller', 'port'),
(52, 'Devices_Controller', 'segment'),
(52, 'Devices_Controller', 'subnet'),
(52, 'Devices_Controller', 'vlan'),
(52, 'Devices_Controller', 'vlan_iface'),
(52, 'Devices_Controller', 'wireless_setting'),
(52, 'Messages_Controller', 'ip_address'),
(52, 'Messages_Controller', 'member'),
(52, 'Messages_Controller', 'message'),
(52, 'Messages_Controller', 'subnet'),
(52, 'Messages_Controller', 'subnet_enabled'),
(54, 'Members_Controller', 'registration'),
(54, 'Users_Controller', 'work'),
(56, 'Accounts_Controller', 'accounts'),
(56, 'Accounts_Controller', 'bank_accounts'),
(56, 'Accounts_Controller', 'bank_transfers'),
(56, 'Accounts_Controller', 'invoices'),
(56, 'Accounts_Controller', 'transfers'),
(56, 'Accounts_Controller', 'unidentifed_transfers'),
(56, 'Accounts_Controller', 'unidentified_transfers'),
(56, 'Devices_Controller', 'admin'),
(56, 'Devices_Controller', 'devices'),
(56, 'Devices_Controller', 'iface'),
(56, 'Devices_Controller', 'ip_address'),
(56, 'Devices_Controller', 'port'),
(56, 'Devices_Controller', 'segment'),
(56, 'Devices_Controller', 'subnet'),
(56, 'Devices_Controller', 'vlan'),
(56, 'Devices_Controller', 'vlan_iface'),
(56, 'Devices_Controller', 'wireless_setting'),
(56, 'Members_Controller', 'address'),
(56, 'Members_Controller', 'comment'),
(56, 'Members_Controller', 'currentcredit'),
(56, 'Members_Controller', 'debit'),
(56, 'Members_Controller', 'en_fee'),
(56, 'Members_Controller', 'en_fee_left'),
(56, 'Members_Controller', 'entrance_date'),
(56, 'Members_Controller', 'fees'),
(56, 'Members_Controller', 'members'),
(56, 'Members_Controller', 'name'),
(56, 'Members_Controller', 'qos_ceil'),
(56, 'Members_Controller', 'qos_rate'),
(56, 'Members_Controller', 'type'),
(56, 'Users_Controller', 'additional_contacts'),
(56, 'Users_Controller', 'comment'),
(56, 'Users_Controller', 'email'),
(56, 'Users_Controller', 'login'),
(56, 'Users_Controller', 'name'),
(56, 'Users_Controller', 'password'),
(56, 'Users_Controller', 'phone'),
(56, 'Users_Controller', 'surname'),
(56, 'Users_Controller', 'users'),
(56, 'Users_Controller', 'work'),
(57, 'Settings_Controller', 'access_rights'),
(57, 'Settings_Controller', 'economy'),
(57, 'Settings_Controller', 'enum_types'),
(57, 'Settings_Controller', 'fees'),
(57, 'Settings_Controller', 'system'),
(57, 'Translations_Controller', 'translation'),
(58, 'Members_Controller', 'address'),
(58, 'Members_Controller', 'comment'),
(58, 'Members_Controller', 'members'),
(58, 'Members_Controller', 'name'),
(58, 'Members_Controller', 'organization_id'),
(58, 'Members_Controller', 'qos_ceil'),
(58, 'Members_Controller', 'qos_rate'),
(58, 'Members_Controller', 'type'),
(58, 'Users_Controller', 'additional_contacts'),
(58, 'Users_Controller', 'comment'),
(58, 'Users_Controller', 'email'),
(58, 'Users_Controller', 'login'),
(58, 'Users_Controller', 'name'),
(58, 'Users_Controller', 'surname'),
(58, 'Users_Controller', 'users'),
(59, 'Address_points_Controller', 'address_point'),
(59, 'Address_points_Controller', 'street'),
(59, 'Address_points_Controller', 'town'),
(59, 'Devices_Controller', 'main_engineer'),
(59, 'Members_Controller', 'entrance_date'),
(59, 'Users_Controller', 'additional_contacts'),
(59, 'Users_Controller', 'email'),
(59, 'Users_Controller', 'login'),
(59, 'Users_Controller', 'member'),
(59, 'Users_Controller', 'password'),
(59, 'Users_Controller', 'phone'),
(60, 'Members_Controller', 'address'),
(60, 'Members_Controller', 'comment'),
(60, 'Members_Controller', 'members'),
(60, 'Members_Controller', 'name'),
(60, 'Users_Controller', 'additional_contacts'),
(60, 'Users_Controller', 'comment'),
(60, 'Users_Controller', 'email'),
(60, 'Users_Controller', 'login'),
(60, 'Users_Controller', 'name'),
(60, 'Users_Controller', 'password'),
(60, 'Users_Controller', 'phone'),
(60, 'Users_Controller', 'surname'),
(60, 'Users_Controller', 'users'),
(60, 'Users_Controller', 'work'),
(62, 'Users_Controller', 'work'),
(63, 'Votes_Controller', 'work'),
(64, 'Users_Controller', 'keys'),
(64, 'Users_Controller', 'work'),
(65, 'Users_Controller', 'application_password'),
(66, 'Users_Controller', 'application_password'),
(67, 'Members_Controller', 'currentcredit'),
(67, 'Members_Controller', 'debit'),
(67, 'Members_Controller', 'en_fee'),
(67, 'Members_Controller', 'en_fee_left'),
(67, 'Members_Controller', 'leaving_date'),
(67, 'Members_Controller', 'membership_interrupts'),
(67, 'Members_Controller', 'registration'),
(67, 'Users_Controller', 'work'),
(67, 'VoIP_Controller', 'voip'),
(67, 'VoIP_Controller', 'voip_password'),
(68, 'Devices_Controller', 'admin'),
(69, 'Devices_Controller', 'admin'),
(70, 'Devices_Controller', 'login'),
(70, 'Devices_Controller', 'password'),
(71, 'Devices_Controller', 'login'),
(71, 'Devices_Controller', 'password'),
(72, 'Phone_invoices_Controller', 'dumps'),
(72, 'Phone_invoices_Controller', 'user_invoices'),
(73, 'Private_phone_contacts_Controller', 'contacts'),
(74, 'Users_Controller', 'additional_contacts'),
(75, 'Members_Controller', 'fees'),
(76, 'Comments_Controller', 'works'),
(77, 'Devices_Controller', 'allowed_subnet'),
(78, 'Clouds_Controller', 'clouds'),
(79, 'Variable_Symbols_Controller', 'variable_symbols');",

"CREATE TABLE IF NOT EXISTS `axo_sections` (
`id` int(11) NOT NULL DEFAULT '0',
`value` varchar(230) COLLATE utf8_czech_ci NOT NULL,
`name` varchar(230) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `value_axo_sections` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",

"INSERT INTO `axo_sections` (`id`, `value`, `name`) VALUES
(10, 'Registration_Controller', 'Self-registration of a new member'),
(13, 'Members_Controller', 'Regular members'),
(14, 'Users_Controller', 'Users of regular members'),
(16, 'Accounts_Controller', 'Accounts, transfers, bank accounts and bank transfers'),
(17, 'Devices_Controller', 'Devices and other dependent objects'),
(18, 'Translations_Controller', 'Translations'),
(19, 'Settings_Controller', 'Settings'),
(20, 'Address_points_Controller', 'Address points'),
(21, 'VoIP_Controller', 'Voip'),
(22, 'Messages_Controller', 'Controller used for handling messages for redirection including setting redirection for IP addresses, members and subnets.'),
(23, 'Votes_Controller', 'Approval'),
(24, 'Phone_invoices_Controller', 'Phone invoice managing'),
(25, 'Private_phone_contacts_Controller', 'Private phone contacts managing'),
(26, 'Ulogd_Controller', 'Network traffics of ip addresses and members'),
(27, 'Clouds_Controller', 'Clouds managing'),
(28, 'Variable_Symbols_Controller', 'Variable symbols managing');",

"CREATE TABLE IF NOT EXISTS `bank_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(254) COLLATE utf8_czech_ci NOT NULL,
`member_id` int(11) DEFAULT NULL,
`account_nr` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`bank_nr` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`IBAN` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`SWIFT` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `bank_statements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bank_account_id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`statement_number` int(11) DEFAULT NULL,
`type` varchar(40) COLLATE utf8_czech_ci DEFAULT NULL,
`from` datetime DEFAULT NULL,
`to` datetime DEFAULT NULL,
`opening_balance` double DEFAULT NULL,
`closing_balance` double DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `bank_account_id` (`bank_account_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `bank_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`template_name` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`item_separator` varchar(1) COLLATE utf8_czech_ci NOT NULL,
`string_separator` varchar(1) COLLATE utf8_czech_ci NOT NULL,
`bank_code` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`account_name` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`account_number` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`constant_symbol` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`variable_symbol` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`specific_symbol` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`counteraccount_name` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`counteraccount_number` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`counteraccount_bank_code` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`text` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`amount` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`expenditure_earning` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`value_for_earning` varchar(10) COLLATE utf8_czech_ci DEFAULT NULL,
`datetime` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `bank_transfers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`origin_id` int(11) DEFAULT NULL COMMENT 'id of the origin bank account in bank_accounts table',
`destination_id` int(11) DEFAULT NULL COMMENT 'id of the destination bank account in bank_accounts table',
`transfer_id` int(11) DEFAULT NULL,
`bank_statement_id` int(11) DEFAULT NULL,
`transaction_code` bigint(20) DEFAULT NULL,
`number` int(11) DEFAULT NULL COMMENT 'Line number or number of the bank listing item',
`variable_symbol` bigint(20) DEFAULT NULL,
`constant_symbol` bigint(20) DEFAULT NULL,
`specific_symbol` bigint(20) DEFAULT NULL,
`comment` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `origin_id` (`origin_id`),
KEY `destination_id` (`destination_id`),
KEY `transfer_id` (`transfer_id`),
KEY `number` (`number`,`variable_symbol`),
KEY `bank_statement_id` (`bank_statement_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `cash` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`transfer_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `transfer_id` (`transfer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='implements cash deposits and withdrawals ' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `clouds` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `clouds_subnets` (
`cloud_id` int(11) NOT NULL,
`subnet_id` int(11) NOT NULL,
PRIMARY KEY (`cloud_id`,`subnet_id`),
KEY `subnet_id` (`subnet_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Join table between subnets and clouds.';",

"CREATE TABLE IF NOT EXISTS `clouds_users` (
`cloud_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`cloud_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Join table between users and clouds.';",

"CREATE TABLE IF NOT EXISTS `comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`comments_thread_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`text` text COLLATE utf8_czech_ci NOT NULL,
`datetime` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `comments_thread_id` (`comments_thread_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `comments_threads` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(255) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `config` (
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`value` text COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",

"INSERT INTO `config` (`name`, `value`) VALUES
('default_request_approval_template', '1'),
('default_work_approval_template', '1'),
('default_work_report_approval_template', '1');",

"CREATE TABLE IF NOT EXISTS `contacts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) NOT NULL,
`value` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `type` (`type`),
KEY `value` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `contacts_countries` (
`contact_id` int(11) NOT NULL,
`country_id` smallint(6) NOT NULL,
PRIMARY KEY (`contact_id`,`country_id`),
KEY `country_id` (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Relation between phone number in contacts to countries.';",

"CREATE TABLE IF NOT EXISTS `countries` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`country_name` varchar(100) COLLATE utf8_czech_ci NOT NULL COMMENT 'Country name in english',
`country_iso` char(3) COLLATE utf8_czech_ci NOT NULL COMMENT 'ISO 3166-1 alpha-3',
`country_code` varchar(4) COLLATE utf8_czech_ci NOT NULL COMMENT 'Telefone prefix of country',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=235 ;",

"INSERT INTO `countries` (`id`, `country_name`, `country_iso`, `country_code`) VALUES
(1, 'Afghanistan', 'AFG', '93'),
(2, 'Albania', 'ALB', '355'),
(3, 'Algeria', 'DZA', '213'),
(4, 'American Samoa', 'ASM', '1684'),
(5, 'Andorra', 'AND', '376'),
(6, 'Angola', 'AGO', '244'),
(7, 'Anguilla', 'AIA', '1264'),
(8, 'Antarctica', 'ATA', '672'),
(9, 'Antigua and Barbuda', 'ATG', '1268'),
(10, 'Argentina', 'ARG', '54'),
(11, 'Armenia', 'ARM', '374'),
(12, 'Aruba', 'ABW', '297'),
(13, 'Australia', 'AUS', '61'),
(14, 'Austria', 'AUT', '43'),
(15, 'Azerbaijan', 'AZE', '994'),
(16, 'Bahamas', 'BHS', '1242'),
(17, 'Bahrain', 'BHR', '973'),
(18, 'Bangladesh', 'BGD', '880'),
(19, 'Barbados', 'BRB', '1246'),
(20, 'Belarus', 'BLR', '375'),
(21, 'Belgium', 'BEL', '32'),
(22, 'Belize', 'BLZ', '501'),
(23, 'Benin', 'BEN', '229'),
(24, 'Bermuda', 'BMU', '1441'),
(25, 'Bhutan', 'BTN', '975'),
(26, 'Bolivia', 'BOL', '591'),
(27, 'Bosnia and Herzegovina', 'BIH', '387'),
(28, 'Botswana', 'BWA', '267'),
(29, 'Brazil', 'BRA', '55'),
(30, 'British Indian Ocean Territory', 'IOT', ''),
(31, 'British Virgin Islands', 'VGB', '1284'),
(32, 'Brunei', 'BRN', '673'),
(33, 'Bulgaria', 'BGR', '359'),
(34, 'Burkina Faso', 'BFA', '226'),
(35, 'Burma (Myanmar)', 'MMR', '95'),
(36, 'Burundi', 'BDI', '257'),
(37, 'Cambodia', 'KHM', '855'),
(38, 'Cameroon', 'CMR', '237'),
(39, 'Canada', 'CAN', '1'),
(40, 'Cape Verde', 'CPV', '238'),
(41, 'Cayman Islands', 'CYM', '1345'),
(42, 'Central African Republic', 'CAF', '236'),
(43, 'Chad', 'TCD', '235'),
(44, 'Chile', 'CHL', '56'),
(45, 'China', 'CHN', '86'),
(46, 'Christmas Island', 'CXR', '61'),
(47, 'Cocos (Keeling) Islands', 'CCK', '61'),
(48, 'Colombia', 'COL', '57'),
(49, 'Comoros', 'COM', '269'),
(50, 'Cook Islands', 'COK', '682'),
(51, 'Costa Rica', 'CRC', '506'),
(52, 'Croatia', 'HRV', '385'),
(53, 'Cuba', 'CUB', '53'),
(54, 'Cyprus', 'CYP', '357'),
(55, 'Czech Republic', 'CZE', '420'),
(56, 'Democratic Republic of the Congo', 'COD', '243'),
(57, 'Denmark', 'DNK', '45'),
(58, 'Djibouti', 'DJI', '253'),
(59, 'Dominica', 'DMA', '1767'),
(60, 'Dominican Republic', 'DOM', '1809'),
(61, 'Ecuador', 'ECU', '593'),
(62, 'Egypt', 'EGY', '20'),
(63, 'El Salvador', 'SLV', '503'),
(64, 'Equatorial Guinea', 'GNQ', '240'),
(65, 'Eritrea', 'ERI', '291'),
(66, 'Estonia', 'EST', '372'),
(67, 'Ethiopia', 'ETH', '251'),
(68, 'Falkland Islands', 'FLK', '500'),
(69, 'Faroe Islands', 'FRO', '298'),
(70, 'Fiji', 'FJI', '679'),
(71, 'Finland', 'FIN', '358'),
(72, 'France', 'FRA', '33'),
(73, 'French Polynesia', 'PYF', '689'),
(74, 'Gabon', 'GAB', '241'),
(75, 'Gambia', 'GMB', '220'),
(76, 'Georgia', 'GEO', '995'),
(77, 'Germany', 'DEU', '49'),
(78, 'Ghana', 'GHA', '233'),
(79, 'Gibraltar', 'GIB', '350'),
(80, 'Greece', 'GRC', '30'),
(81, 'Greenland', 'GRL', '299'),
(82, 'Grenada', 'GRD', '1473'),
(83, 'Guam', 'GUM', '1671'),
(84, 'Guatemala', 'GTM', '502'),
(85, 'Guinea', 'GIN', '224'),
(86, 'Guinea-Bissau', 'GNB', '245'),
(87, 'Guyana', 'GUY', '592'),
(88, 'Haiti', 'HTI', '509'),
(89, 'Holy See (Vatican City)', 'VAT', '39'),
(90, 'Honduras', 'HND', '504'),
(91, 'Hong Kong', 'HKG', '852'),
(92, 'Hungary', 'HUN', '36'),
(93, 'Iceland', 'IS', '354'),
(94, 'India', 'IND', '91'),
(95, 'Indonesia', 'IDN', '62'),
(96, 'Iran', 'IRN', '98'),
(97, 'Iraq', 'IRQ', '964'),
(98, 'Ireland', 'IRL', '353'),
(99, 'Isle of Man', 'IMN', '44'),
(100, 'Israel', 'ISR', '972'),
(101, 'Italy', 'ITA', '39'),
(102, 'Ivory Coast', 'CIV', '225'),
(103, 'Jamaica', 'JAM', '1876'),
(104, 'Japan', 'JPN', '81'),
(105, 'Jersey', 'JEY', ''),
(106, 'Jordan', 'JOR', '962'),
(107, 'Kazakhstan', 'KAZ', '7'),
(108, 'Kenya', 'KEN', '254'),
(109, 'Kiribati', 'KIR', '686'),
(110, 'Kuwait', 'KWT', '965'),
(111, 'Kyrgyzstan', 'KGZ', '996'),
(112, 'Laos', 'LAO', '856'),
(113, 'Latvia', 'LVA', '371'),
(114, 'Lebanon', 'LBN', '961'),
(115, 'Lesotho', 'LSO', '266'),
(116, 'Liberia', 'LBR', '231'),
(117, 'Libya', 'LBY', '218'),
(118, 'Liechtenstein', 'LIE', '423'),
(119, 'Lithuania', 'LTU', '370'),
(120, 'Luxembourg', 'LUX', '352'),
(121, 'Macau', 'MAC', '853'),
(122, 'Macedonia', 'MKD', '389'),
(123, 'Madagascar', 'MDG', '261'),
(124, 'Malawi', 'MWI', '265'),
(125, 'Malaysia ', 'MYS', '60'),
(126, 'Maldives', 'MDV', '960'),
(127, 'Mali', 'MLI', '223'),
(128, 'Malta', 'MLT', '356'),
(129, 'Marshall Islands', 'MHL', '692'),
(130, 'Mauritania', 'MRT', '222'),
(131, 'Mauritius', 'MUS', '230'),
(132, 'Mayotte ', 'MYT', '262'),
(133, 'Mexico', 'MEX', '52'),
(134, 'Micronesia', 'FSM', '691'),
(135, 'Moldova', 'MDA', '373'),
(136, 'Monaco', 'MCO', '377'),
(137, 'Mongolia ', 'MNG', '976'),
(138, 'Montenegro ', 'MNE', '382'),
(139, 'Montserrat', 'MSR', '1664'),
(140, 'Morocco', 'MAR', '212'),
(141, 'Mozambique', 'MOZ', '258'),
(142, 'Namibia ', 'NAM', '264'),
(143, 'Nauru', 'NRU', '674'),
(144, 'Nepal', 'NPL', '977'),
(145, 'Netherlands', 'NLD', '31'),
(146, 'Netherlands Antilles', 'ANT', '599'),
(147, 'New Caledonia', 'NCL', '687'),
(148, 'New Zealand ', 'NZL', '64'),
(149, 'Nicaragua', 'NIC', '505'),
(150, 'Niger', 'NER', '227'),
(151, 'Nigeria', 'NGA', '234'),
(152, 'Niue', 'NIU', '683'),
(153, 'Norfolk Island', 'NFK', '672'),
(154, 'North Korea', 'PRK', '850'),
(155, 'Northern Mariana Islands', 'MNP', '1670'),
(156, 'Norway', 'NOR', '47'),
(157, 'Oman', 'OMN', '968'),
(158, 'Pakistan', 'PAK', '92'),
(159, 'Palau', 'PLW', '680'),
(160, 'Panama', 'PAN', '507'),
(161, 'Papua New Guinea', 'PNG', '675'),
(162, 'Paraguay', 'PRY', '595'),
(163, 'Peru ', 'PER', '51'),
(164, 'Philippines', 'PHL', '63'),
(165, 'Pitcairn Islands', 'PCN', '870'),
(166, 'Poland', 'POL', '48'),
(167, 'Portugal', 'PRT', '351'),
(168, 'Puerto Rico', 'PRI', '1'),
(169, 'Qatar', 'QAT', '974'),
(170, 'Republic of the Congo', 'COG', '242'),
(171, 'Romania', 'ROU', '40'),
(172, 'Russia', 'RUS', '7'),
(173, 'Rwanda', 'RWA', '250'),
(174, 'Saint Barthelemy', 'BLM', '590'),
(175, 'Saint Helena', 'SHN', '290'),
(176, 'Saint Kitts and Nevis ', 'KNA', '1869'),
(177, 'Saint Lucia', 'LCA', '1758'),
(178, 'Saint Martin', 'MAF', '1599'),
(179, 'Saint Pierre and Miquelon', 'SPM', '508'),
(180, 'Saint Vincent and the Grenadines', 'VCT', '1784'),
(181, 'Samoa', 'WSM', '685'),
(182, 'San Marino', 'SMR', '378'),
(183, 'Sao Tome and Principe', 'STP', '239'),
(184, 'Saudi Arabia', 'SAU', '966'),
(185, 'Senegal', 'SEN', '221'),
(186, 'Serbia', 'SRB', '381'),
(187, 'Seychelles', 'SYC', '248'),
(188, 'Sierra Leone', 'SLE', '232'),
(189, 'Singapore', 'SGP', '65'),
(190, 'Slovakia', 'SVK', '421'),
(191, 'Slovenia', 'SVN', '386'),
(192, 'Solomon Islands', 'SLB', '677'),
(193, 'Somalia', 'SOM', '252'),
(194, 'South Africa', 'ZAF', '27'),
(195, 'South Korea', 'KOR', '82'),
(196, 'Spain', 'ESP', '34'),
(197, 'Sri Lanka', 'LKA', '94'),
(198, 'Sudan', 'SDN', '249'),
(199, 'Suriname', 'SUR', '597'),
(200, 'Svalbard', 'SJM', ''),
(201, 'Swaziland', 'SWZ', '268'),
(202, 'Sweden', 'SWE', '46'),
(203, 'Switzerland', 'CHE', '41'),
(204, 'Syria', 'SYR', '963'),
(205, 'Taiwan', 'TWN', '886'),
(206, 'Tajikistan', 'TJK', '992'),
(207, 'Tanzania', 'TZA', '255'),
(208, 'Thailand', 'THA', '66'),
(209, 'Timor-Leste', 'TLS', '670'),
(210, 'Togo', 'TGO', '228'),
(211, 'Tokelau', 'TKL', '690'),
(212, 'Tonga', 'TON', '676'),
(213, 'Trinidad and Tobago', 'TTO', '1868'),
(214, 'Tunisia', 'TUN', '216'),
(215, 'Turkey', 'TUR', '90'),
(216, 'Turkmenistan', 'TKM', '993'),
(217, 'Turks and Caicos Islands', 'TCA', '1649'),
(218, 'Tuvalu', 'TUV', '688'),
(219, 'Uganda', 'UGA', '256'),
(220, 'Ukraine', 'UKR', '380'),
(221, 'United Arab Emirates', 'ARE', '971'),
(222, 'United Kingdom', 'GBR', '44'),
(223, 'United States', 'USA', '1'),
(224, 'Uruguay', 'URY', '598'),
(225, 'US Virgin Islands', 'VIR', '1340'),
(226, 'Uzbekistan', 'UZB', '998'),
(227, 'Vanuatu', 'VUT', '678'),
(228, 'Venezuela', 'VEN', '58'),
(229, 'Vietnam', 'VNM', '84'),
(230, 'Wallis and Futuna', 'WLF', '681'),
(231, 'Western Sahara', 'ESH', ''),
(232, 'Yemen', 'YEM', '967'),
(233, 'Zambia', 'ZMB', '260'),
(234, 'Zimbabwe', 'ZWE', '263');",

"CREATE TABLE IF NOT EXISTS `devices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`address_point_id` int(11) DEFAULT NULL,
`name` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`type` int(11) NOT NULL,
`trade_name` varchar(50) COLLATE utf8_czech_ci DEFAULT NULL,
`operating_system` tinyint(4) DEFAULT NULL,
`PPPoE_logging_in` tinyint(4) DEFAULT NULL,
`login` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`password` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`price` double DEFAULT NULL,
`payment_rate` double DEFAULT NULL,
`buy_date` date DEFAULT NULL,
`comment` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `address_point_id` (`address_point_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `device_admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `device_id` (`device_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `device_engineers` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`device_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `device_id` (`device_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `device_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`enum_type_id` int(11) NOT NULL,
`name` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`values` text COLLATE utf8_czech_ci NOT NULL,
`default` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `device_templates_category_id` (`enum_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `email_queues` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`from` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`to` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`subject` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`body` text COLLATE utf8_czech_ci NOT NULL,
`state` tinyint(4) NOT NULL,
`access_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `from` (`from`,`to`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `enum_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_id` int(11) NOT NULL,
`value` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`read_only` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `type_id` (`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=82 ;",

"INSERT INTO `enum_types` (`id`, `type_id`, `value`, `read_only`) VALUES
(1, 1, 'Applicant', 1),
(2, 1, 'Regular member', 1),
(3, 1, 'Honorary member', 1),
(4, 1, 'Sympathizing member', 1),
(5, 1, 'Non-member', 1),
(6, 1, 'Fee-free regular member', 1),
(7, 2, 'PC', 1),
(8, 2, 'client', 1),
(9, 2, 'router', 1),
(10, 2, 'switch', 1),
(11, 3, 'member', 1),
(12, 3, 'member', 1),
(13, 3, 'user', 1),
(14, 3, 'other', 1),
(15, 1, 'Former member', 1),
(17, 2, 'notebook', 1),
(18, 4, 'ICQ', 1),
(19, 4, 'Jabber', 1),
(20, 4, 'E-mail', 1),
(21, 4, 'Phone', 1),
(22, 4, 'Skype', 1),
(23, 4, 'MSN', 1),
(24, 2, 'home AP', 1),
(25, 4, 'Website', 1),
(26, 2, 'VoIP', 1),
(27, 5, 'bank', 1),
(28, 5, 'credit', 1),
(30, 5, 'project', 1),
(31, 5, 'operating', 1),
(32, 5, 'infrastructure', 1),
(33, 5, 'suppliers', 1),
(34, 5, 'unidentified', 1),
(35, 6, 'regular member fee', 1),
(36, 6, 'entrance fee', 1),
(37, 6, 'transfer fee', 1),
(38, 6, 'bank transfer fee', 1),
(39, 6, 'penalty', 1),
(42, 5, 'debit', 0),
(43, 5, 'tax', 0),
(44, 5, 'non-tax', 0),
(45, 7, 'balance sheet ', 0),
(46, 7, 'sub-ledger', 0),
(47, 7, 'closing', 0),
(48, 7, 'income statement', 0),
(49, 8, 'AP', 1),
(50, 8, 'Client', 1),
(51, 9, '802.11a', 1),
(52, 9, '802.11b', 1),
(53, 9, '802.11g', 1),
(54, 9, '802.11n', 1),
(55, 10, 'Directional', 1),
(56, 10, 'Omnidirectional', 1),
(57, 10, 'Sectional', 1),
(58, 11, 'Horizontal', 1),
(59, 11, 'Vertical', 1),
(60, 11, 'Circular', 1),
(61, 12, 'air', 1),
(62, 12, 'cable', 1),
(63, 12, 'single-mode optical fiber', 1),
(64, 12, 'multi-mode optical fiber', 1),
(65, 9, '802.11b/g', 1),
(66, 2, 'AP', 1),
(67, 11, 'Horizontal and vertical', 0),
(68, 14, 'Virus', 1),
(69, 14, 'Spam', 1),
(70, 14, 'Message', 1),
(71, 14, 'Admin contacting', 1),
(72, 14, 'Rules breaking', 1),
(77, 15, 'redirected', 1),
(78, 15, 'edited', 1),
(79, 15, 'deleted', 1),
(80, 16, 'RB mikrotik', 1),
(81, 16, 'PC router', 1);",

"CREATE TABLE IF NOT EXISTS `enum_type_names` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17 ;",

"INSERT INTO `enum_type_names` (`id`, `type_name`) VALUES
(1, 'Member types'),
(2, 'Device types'),
(3, 'User types'),
(4, 'Contact types'),
(5, 'Account types'),
(6, 'Fees types'),
(7, 'Account kinds'),
(8, 'Wireless modes'),
(9, 'Wireless norms'),
(10, 'Antennas'),
(11, 'Polarizations'),
(12, 'Media'),
(14, 'Redirect destination'),
(15, 'Redirect action'),
(16, 'backup platform');",

"CREATE TABLE IF NOT EXISTS `fees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`readonly` tinyint(1) NOT NULL,
`fee` double NOT NULL,
`from` date NOT NULL,
`to` date NOT NULL,
`type_id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL COMMENT 'Optional name for fee, useable as tariff name in case of regular member fee',
`special_type_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `type_id` (`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `filter_queries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`url` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`values` text COLLATE utf8_czech_ci NOT NULL,
`default` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `groups_aro_map` (
`group_id` int(11) NOT NULL DEFAULT '0',
`aro_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`group_id`,`aro_id`),
KEY `aro_id` (`aro_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",

"CREATE TABLE IF NOT EXISTS `ifaces` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) NOT NULL,
`device_id` int(11) NOT NULL,
`link_id` int(11) DEFAULT NULL,
`mac` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`name` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`number` int(11) DEFAULT NULL,
`wireless_mode` int(11) DEFAULT NULL,
`wireless_antenna` int(11) DEFAULT NULL,
`port_mode` int(11) DEFAULT NULL,
`comment` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `device_iface` (`device_id`),
KEY `segment_iface` (`link_id`),
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `ifaces_relationships` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_iface_id` int(11) NOT NULL,
`iface_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `parent_iface_id` (`iface_id`),
KEY `iface_id` (`iface_id`),
KEY `parent_iface_id_2` (`parent_iface_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `ifaces_vlans` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iface_id` int(11) NOT NULL,
`vlan_id` int(11) NOT NULL,
`tagged` tinyint(1) DEFAULT NULL,
`port_vlan` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `iface_id` (`iface_id`),
KEY `vlan_id` (`vlan_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `invoices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`supplier_id` int(11) DEFAULT NULL,
`invoice_nr` double NOT NULL,
`var_sym` double NOT NULL,
`con_sym` double NOT NULL,
`date_inv` date NOT NULL,
`date_due` date NOT NULL,
`date_vat` date NOT NULL,
`vat` double NOT NULL,
`order_nr` double NOT NULL,
`currency` varchar(3) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `supplier_id` (`supplier_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `invoice_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invoice_id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`code` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`quantity` double NOT NULL,
`author_fee` double NOT NULL,
`contractual_increase` double NOT NULL,
`service` tinyint(1) NOT NULL,
`price` double NOT NULL,
`price_vat` double NOT NULL,
PRIMARY KEY (`id`),
KEY `invoice_id` (`invoice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `invoice_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) COLLATE utf8_czech_ci NOT NULL,
`supplier_id` int(11) NOT NULL,
`invoice_nr` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`var_sym` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`con_sym` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`date_inv` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`date_due` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`date_vat` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`vat` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`order_nr` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`currency` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`org_id` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`charset` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`xml` tinyint(1) NOT NULL,
`begin_tag` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`end_tag` varchar(100) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;",

"INSERT INTO `invoice_templates` (`id`, `name`, `supplier_id`, `invoice_nr`, `var_sym`, `con_sym`, `date_inv`, `date_due`, `date_vat`, `vat`, `order_nr`, `currency`, `org_id`, `charset`, `xml`, `begin_tag`, `end_tag`) VALUES
(1, 'ED invoice in XML', 0, 'string(/INVOICES/INVOICE/INV_ID)', 'string(/INVOICES/INVOICE/VAR_SYM)', 'string(/INVOICES/INVOICE/CON_SYM)', 'concat(substring(string(/INVOICES/INVOICE/DATE_INV),7,4),''-'',substring(string(/INVOICES/INVOICE/DATE_INV),4,2),''-'',substring(string(/INVOICES/INVOICE/DATE_INV),1,2))', 'concat(substring(string(/INVOICES/INVOICE/DATE_DUE),7,4),''-'',substring(string(/INVOICES/INVOICE/DATE_DUE),4,2),''-'',substring(string(/INVOICES/INVOICE/DATE_DUE),1,2))', 'concat(substring(string(/INVOICES/INVOICE/DATE_VAT),7,4),''-'',substring(string(/INVOICES/INVOICE/DATE_VAT),4,2),''-'',substring(string(/INVOICES/INVOICE/DATE_VAT),1,2))', 'number(starts-with(string(/INVOICES/INVOICE/VAT),''True''))', 'string(/INVOICES/INVOICE/ORD_ID)', 'string(/INVOICES/INVOICE/CUR_ID)', '''''', 'utf-8', 1, '', ''),
(2, 'Pohoda invoice in HTML', 0, 'string(/XML/eform/invoice/documentTax/@number)', 'string(/XML/eform/invoice/documentTax/@symVar)', 'string(/XML/eform/invoice/documentTax/@symConst)', 'string(/XML/eform/invoice/documentTax/@date)', 'string(/XML/eform/invoice/documentTax/@dateDue)', 'string(/XML/eform/invoice/documentTax/@dateTax)', '0', 'string(/XML/eform/invoice/documentTax/@numberOrder)', '''''', 'string(/XML/eform/invoice/supplier/ico)', 'iso-8859-2', 0, '<XML>', '</XML>');",

"CREATE TABLE IF NOT EXISTS `ip_addresses` (
`iface_id` int(11) DEFAULT NULL,
`subnet_id` int(11) DEFAULT NULL,
`member_id` int(11) DEFAULT NULL,
`ip_address` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`dhcp` tinyint(4) DEFAULT NULL,
`gateway` tinyint(4) DEFAULT NULL,
`service` tinyint(4) NOT NULL DEFAULT '0',
`whitelisted` tinyint(4) DEFAULT NULL COMMENT 'IP address with whitelisted flag is never redirected',
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `ip_addresses_key_iface_id` (`iface_id`),
KEY `ip_addresses_key_subnet_id` (`subnet_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `ip_addresses_traffics` (
`ip_address` varchar(15) COLLATE utf8_czech_ci NOT NULL,
`upload` int(11) unsigned NOT NULL,
`download` int(11) unsigned NOT NULL,
`local_upload` int(11) NOT NULL,
`local_download` int(11) NOT NULL,
`member_id` int(11) DEFAULT NULL,
PRIMARY KEY (`ip_address`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",

"CREATE TABLE IF NOT EXISTS `jobs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_report_id` int(11) DEFAULT NULL COMMENT 'belongs to job report',
`user_id` int(11) NOT NULL,
`previous_rejected_work_id` int(11) DEFAULT NULL,
`added_by_id` int(11) DEFAULT NULL,
`approval_template_id` int(11) DEFAULT NULL,
`description` mediumtext COLLATE utf8_czech_ci,
`suggest_amount` int(11) NOT NULL COMMENT 'suggest amount by user',
`date` date NOT NULL,
`create_date` datetime NOT NULL COMMENT 'date of creation of work in IS',
`hours` float DEFAULT NULL,
`km` int(11) NOT NULL,
`state` tinyint(1) NOT NULL,
`transfer_id` int(11) DEFAULT NULL,
`comments_thread_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `commited_by` (`user_id`),
KEY `transfer_salary` (`transfer_id`),
KEY `comments_thread_id` (`comments_thread_id`),
KEY `job_report_id` (`job_report_id`),
KEY `added_by_id` (`added_by_id`),
KEY `approval_template_id` (`approval_template_id`),
KEY `previous_rejected_work_id` (`previous_rejected_work_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `job_reports` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`added_by_id` int(11) DEFAULT NULL,
`transfer_id` int(11) DEFAULT NULL,
`approval_template_id` int(11) NOT NULL,
`description` text COLLATE utf8_czech_ci NOT NULL,
`type` char(7) COLLATE utf8_czech_ci DEFAULT NULL COMMENT 'If null then type is gouped report, else type is monthly report and should contains date string in form ''YYYY-mm''',
`price_per_hour` double NOT NULL COMMENT 'Price per hour for each work in report.',
`price_per_km` double NOT NULL COMMENT 'Price per kilometre for each work in report.',
`concept` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Concept is displayed only to owner',
`payment_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Specified payment, 0 is credit payment, 1 is cash payment, see model for more details',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `approval_template_id` (`approval_template_id`),
KEY `transfer_id` (`transfer_id`),
KEY `added_by_id` (`added_by_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`medium` int(11) NOT NULL,
`bitrate` bigint(20) DEFAULT NULL,
`duplex` tinyint(4) DEFAULT NULL,
`wireless_ssid` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`wireless_norm` int(11) DEFAULT NULL,
`wireless_frequency` int(11) DEFAULT NULL,
`wireless_channel` int(11) DEFAULT NULL,
`wireless_channel_width` int(11) DEFAULT NULL,
`wireless_polarization` int(11) DEFAULT NULL,
`comment` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`gps` linestring DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `local_subnets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`network_address` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`netmask` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `network_address_2` (`network_address`),
KEY `network_address` (`network_address`),
KEY `netmask` (`netmask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `login_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`time` datetime NOT NULL,
`IP_address` varchar(15) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `time` (`time`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci ROW_FORMAT=COMPACT AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `mail_messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`from_id` int(11) NOT NULL,
`to_id` int(11) NOT NULL,
`subject` varchar(150) COLLATE utf8_czech_ci NOT NULL,
`body` text COLLATE utf8_czech_ci NOT NULL,
`time` datetime NOT NULL,
`readed` tinyint(1) NOT NULL DEFAULT '0',
`from_deleted` tinyint(1) NOT NULL DEFAULT '0',
`to_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `from_id` (`from_id`),
KEY `to_id` (`to_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `members` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT 'id of user who added member',
`registration` tinyint(1) NOT NULL,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`address_point_id` int(11) NOT NULL,
`type` tinyint(4) DEFAULT NULL,
`external_type` tinyint(4) DEFAULT NULL,
`organization_identifier` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`qos_ceil` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`qos_rate` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`entrance_fee` double DEFAULT NULL,
`debt_payment_rate` double DEFAULT NULL,
`entrance_fee_left` double DEFAULT NULL,
`entrance_fee_date` date DEFAULT NULL,
`entrance_date` date DEFAULT NULL,
`entrance_form_received` date DEFAULT NULL,
`entrance_form_accepted` date DEFAULT NULL,
`leaving_date` date NOT NULL,
`applicant_registration_datetime` datetime DEFAULT NULL COMMENT 'Used only for members who were registered by registration form by them self.',
`locked` tinyint(4) NOT NULL DEFAULT '0',
`voip_billing_limit` int(11) NOT NULL DEFAULT '0',
`voip_billing_type` varchar(10) COLLATE utf8_czech_ci NOT NULL DEFAULT 'prepaid',
`comment` varchar(250) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `address_point_id` (`address_point_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `membership_interrupts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`members_fee_id` int(11) DEFAULT NULL,
`comment` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `members_fee_id` (`members_fee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `members_domiciles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`address_point_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`,`address_point_id`),
KEY `address_point_id` (`address_point_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `members_fees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fee_id` int(11) NOT NULL,
`member_id` int(11) NOT NULL,
`activation_date` date NOT NULL DEFAULT '0000-00-00',
`deactivation_date` date DEFAULT NULL,
`priority` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `fee_id` (`fee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Junction table between fees and members, used primarily for different tariffs' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `members_traffics` (
`member_id` int(11) NOT NULL,
`upload` int(11) unsigned NOT NULL,
`download` int(11) unsigned NOT NULL,
`local_upload` int(11) NOT NULL,
`local_download` int(11) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '0',
`day` date NOT NULL,
PRIMARY KEY (`member_id`,`day`),
KEY `member_id` (`member_id`),
KEY `day` (`day`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",

"CREATE TABLE IF NOT EXISTS `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL COMMENT 'Name of the redirection message',
`text` text COLLATE utf8_czech_ci COMMENT 'Content of message, can contain HTML code.',
`email_text` text COLLATE utf8_czech_ci,
`sms_text` varchar(760) COLLATE utf8_czech_ci DEFAULT NULL,
`type` tinyint(4) DEFAULT NULL COMMENT 'Types of messages are saved in Mesage_Model.',
`self_cancel` tinyint(4) DEFAULT NULL COMMENT 'Possibility of self-canceling of redirection message.',
`ignore_whitelist` tinyint(4) DEFAULT '0' COMMENT 'If set, than IP address in whitelist are also redirected.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='messages used for redirection' AUTO_INCREMENT=8 ;",

"INSERT INTO `messages` (`id`, `name`, `text`, `email_text`, `sms_text`, `type`, `self_cancel`, `ignore_whitelist`) VALUES
(1, 'Contact information', 'Side panel with contacts', NULL, NULL, 1, NULL, 0),
(2, 'Page after canceling redirection', 'Content of page after redirection', NULL, NULL, 2, NULL, 0),
(3, 'Unknown device', 'Content of unknown device page', NULL, NULL, 3, 0, 0),
(4, 'Interrupted membership message', 'Content of page for interrupted membership', NULL, NULL, 4, 0, 0),
(5, 'Debtor message', 'Content of page for debtors', NULL, NULL, 5, 0, 0),
(6, 'Payment notice', 'Content of page for payment notice', NULL, NULL, 6, 1, 0),
(7, 'Unallowed connecting place', NULL, NULL, NULL, 7, 0, 0);",

"CREATE TABLE IF NOT EXISTS `messages_ip_addresses` (
`message_id` int(11) NOT NULL COMMENT 'redirection message',
`ip_address_id` int(11) NOT NULL COMMENT 'redirected ip address',
`user_id` int(11) DEFAULT NULL COMMENT 'user id of admin who redirects',
`comment` text COLLATE utf8_czech_ci COMMENT 'personal comment from admin for redirected user',
`datetime` datetime NOT NULL COMMENT 'Date and time of setting redirection',
PRIMARY KEY (`message_id`,`ip_address_id`),
KEY `user_id` (`user_id`),
KEY `ip_address_id` (`ip_address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='junction table between redirected ip address and message of redirection';",

"CREATE TABLE IF NOT EXISTS `monitor_hosts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) NOT NULL,
`state` tinyint(1) NOT NULL,
`state_changed` tinyint(1) NOT NULL,
`state_changed_date` datetime NOT NULL,
`last_attempt_date` datetime NOT NULL,
`last_notification_date` datetime DEFAULT NULL,
`latency_current` float DEFAULT NULL,
`latency_min` float DEFAULT NULL,
`latency_max` float DEFAULT NULL,
`latency_avg` float DEFAULT NULL,
`polls_total` bigint(11) NOT NULL,
`polls_failed` bigint(11) NOT NULL,
`availability` float NOT NULL,
`priority` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `device_id` (`device_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_calls` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Call started at',
`price` float NOT NULL,
`length` time NOT NULL,
`number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Called',
`period` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`description` text COLLATE utf8_czech_ci,
`private` tinyint(1) DEFAULT '1' COMMENT 'Was call private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`),
KEY `number` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of call service of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_connections` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Connection started at',
`price` float NOT NULL,
`transfered` int(11) NOT NULL COMMENT 'In kB',
`period` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`apn` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(1) DEFAULT '1' COMMENT 'Was it private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of data service(internet connection) of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_fixed_calls` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Call started at',
`price` float NOT NULL,
`length` time NOT NULL,
`number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Called',
`period` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`destiny` varchar(200) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(1) DEFAULT '1' COMMENT 'Was fised call private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`),
KEY `number` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of fixed call service of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_invoices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date_of_issuance` date NOT NULL,
`billing_period_from` date NOT NULL,
`billing_period_to` date NOT NULL,
`variable_symbol` int(11) NOT NULL,
`specific_symbol` int(11) NOT NULL,
`total_price` float NOT NULL COMMENT 'Price without taxes',
`tax` float NOT NULL COMMENT 'DPH',
`tax_rate` smallint(6) NOT NULL COMMENT 'DPH in percents',
`locked` tinyint(1) DEFAULT '0' COMMENT 'Indicate if invoice is locked for editing from users (not admin)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of phone invoices' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_invoice_users` (
`user_id` int(11) DEFAULT NULL COMMENT 'ID of user or NULL if user was not assigned yet',
`phone_invoice_id` int(11) NOT NULL,
`transfer_id` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`phone_number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Phone nuber with prefix with leading plus',
`locked` tinyint(1) unsigned NOT NULL COMMENT 'User locked his invoice as filled in.',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`,`phone_invoice_id`),
KEY `phone_invoice_id` (`phone_invoice_id`),
KEY `phone_number` (`phone_number`),
KEY `transfer_id` (`transfer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of user invoices for phone' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_operators` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`country_id` smallint(6) NOT NULL,
`name` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`phone_number_length` smallint(2) DEFAULT '6',
`sms_enabled` tinyint(1) DEFAULT '0' COMMENT 'Allows SMS sendind for this operator?',
PRIMARY KEY (`id`),
KEY `country_id` (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_operator_prefixes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phone_operator_id` int(11) NOT NULL,
`prefix` varchar(4) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `prefix` (`prefix`),
KEY `phone_operator_id` (`phone_operator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_pays` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Payed at',
`price` float NOT NULL,
`number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Pay to',
`description` varchar(200) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(4) DEFAULT '1' COMMENT 'Was pay private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`),
KEY `number` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of pays of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_roaming_sms_messages` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Message send at',
`price` float NOT NULL,
`roaming_zone` varchar(200) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(4) DEFAULT '1' COMMENT 'Was message private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of sms messages service of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_sms_messages` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Message send at',
`price` float NOT NULL,
`number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Send to',
`period` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`description` varchar(200) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(4) DEFAULT '1' COMMENT 'Was message private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`),
KEY `number` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of sms messages service of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `phone_vpn_calls` (
`phone_invoice_user_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL COMMENT 'Call started at',
`price` float NOT NULL,
`length` time NOT NULL,
`number` varchar(15) COLLATE utf8_czech_ci NOT NULL COMMENT 'Called to',
`period` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`group` varchar(200) COLLATE utf8_czech_ci DEFAULT NULL,
`private` tinyint(1) DEFAULT '1' COMMENT 'Was call private?',
PRIMARY KEY (`id`),
KEY `phone_invoice_users_id` (`phone_invoice_user_id`),
KEY `datetime` (`datetime`),
KEY `number` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Table of vpn call service of phone invoice' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `private_users_contacts` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user_id` int(10) NOT NULL COMMENT 'User who has private contact',
`contact_id` int(10) NOT NULL,
`description` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`,`contact_id`),
KEY `private_users_contacts_ibfk_2` (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Private address book of each user' AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `sms_messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`sms_message_id` int(11) DEFAULT NULL,
`stamp` datetime NOT NULL,
`send_date` datetime NOT NULL,
`text` varchar(800) COLLATE utf8_czech_ci NOT NULL,
`sender` varchar(14) COLLATE utf8_czech_ci NOT NULL,
`receiver` varchar(14) COLLATE utf8_czech_ci NOT NULL,
`driver` tinyint(4) NOT NULL,
`type` tinyint(4) NOT NULL,
`state` tinyint(4) NOT NULL,
`message` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `sms_message_id` (`sms_message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `streets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`town_id` int(11) DEFAULT NULL,
`street` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`gps` polygon DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `street` (`street`),
KEY `town_id` (`town_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `subnets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`OSPF_area_id` int(11) DEFAULT NULL,
`name` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`network_address` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`netmask` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`redirect` tinyint(4) DEFAULT NULL COMMENT 'Bit mask for types of redirect',
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `network_address` (`network_address`),
KEY `netmask` (`netmask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `subnets_owners` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`subnet_id` int(11) NOT NULL,
`member_id` int(11) NOT NULL,
`redirect` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `redirect` (`redirect`),
KEY `subnet_id` (`subnet_id`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `towns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`zip_code` varchar(10) COLLATE utf8_czech_ci NOT NULL,
`town` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`quarter` varchar(50) COLLATE utf8_czech_ci DEFAULT NULL,
`gps` polygon DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `town` (`town`),
KEY `zip_code` (`zip_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `transfers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`origin_id` int(11) DEFAULT NULL,
`destination_id` int(11) DEFAULT NULL,
`previous_transfer_id` int(11) DEFAULT NULL,
`member_id` int(11) DEFAULT NULL COMMENT 'id of the member, to whom the transaction is assigned',
`user_id` int(11) DEFAULT NULL COMMENT 'id of user, who added transfer',
`type` tinyint(4) DEFAULT NULL,
`datetime` datetime NOT NULL,
`creation_datetime` datetime NOT NULL,
`text` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`amount` double NOT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `datetime` (`datetime`,`text`),
KEY `origin_id` (`origin_id`),
KEY `destination_id` (`destination_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `translations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`original_term` varchar(254) COLLATE utf8_czech_ci NOT NULL,
`translated_term` varchar(254) COLLATE utf8_czech_ci NOT NULL,
`lang` varchar(50) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `original_term` (`original_term`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=61 ;",

"INSERT INTO `translations` (`id`, `original_term`, `translated_term`, `lang`) VALUES
(1, 'client', 'klient', 'cs'),
(2, 'home AP', 'domácí AP', 'cs'),
(3, 'Telephone', 'Telefon', 'cs'),
(4, 'Applicant', 'Čekatel na členství', 'cs'),
(5, 'Regular member', 'Řádný člen', 'cs'),
(6, 'Honorary member', 'Čestný člen', 'cs'),
(7, 'Former member', 'Bývalý člen', 'cs'),
(8, 'Vacating member', 'Prázdninový člen', 'cs'),
(9, 'Non-statutory member', 'Člen bez statusu', 'cs'),
(10, 'Bad payer', 'Neplatič', 'cs'),
(11, 'Non-member', 'Nečlen', 'cs'),
(12, 'Phone', 'Telefon', 'cs'),
(13, 'Website', 'Web', 'cs'),
(14, 'regular member fee', 'pravidelný členský příspěvek', 'cs'),
(15, 'entrance fee', 'vstupní příspěvek', 'cs'),
(16, 'transfer fee', 'poplatek za transakci', 'cs'),
(17, 'bank transfer fee', 'poplatek za bankovní transakci', 'cs'),
(18, 'penalty', 'pokuta', 'cs'),
(19, 'bank', 'bankovní', 'cs'),
(20, 'credit', 'kreditní', 'cs'),
(21, 'infrastructure', 'infrastrukturní', 'cs'),
(22, 'suppliers', 'dodavatelé', 'cs'),
(23, 'unidentified', 'neidentifikovaný', 'cs'),
(24, 'bank fees', 'bankovní poplatky', 'cs'),
(25, 'bank interests', 'bankovní úroky', 'cs'),
(26, 'operating', 'provozní', 'cs'),
(27, 'credit', 'pasivní', 'cs'),
(28, 'debit', 'aktivní', 'cs'),
(29, 'tax', 'daňový', 'cs'),
(30, 'non-tax', 'nedaňový', 'cs'),
(31, 'balance sheet', 'rozvahový', 'cs'),
(32, 'sub-ledger', 'podrozvahový', 'cs'),
(33, 'closing', 'závěrkový', 'cs'),
(34, 'income statement', 'výsledovkový', 'cs'),
(35, 'Fee-free regular member', 'Řádný člen osvobozený od členských příspěvků', 'cs'),
(36, 'Sympathizing member', 'Sympatizující člen', 'cs'),
(38, 'Directional', 'Směrová', 'cs'),
(39, 'Omnidirectional', 'Všesměrová', 'cs'),
(40, 'Sectional', 'Sektorová', 'cs'),
(41, 'Horizontal', 'Horizontální', 'cs'),
(42, 'Vertical', 'Vertikální', 'cs'),
(43, 'Circular', 'Kruhová', 'cs'),
(44, 'air', 'vzduch', 'cs'),
(45, 'cable', 'kabel', 'cs'),
(46, 'single-mode optical fiber', 'jednovidové optické vlákno', 'cs'),
(47, 'multi-mode optical fiber', 'vícevidové optické vlákno', 'cs'),
(48, 'Horizontal and vertical', 'Horizontální i vertikální', 'cs'),
(49, '4 hours', '4 hodiny', 'cs'),
(50, 'End of day', 'Do konce dne', 'cs'),
(51, 'End of month', 'Do konce měsíce', 'cs'),
(52, 'Indefinitely', 'Na neurčito', 'cs'),
(53, 'Admin contacting', 'Kontaktovaní správce', 'cs'),
(54, 'Message', 'Zpráva', 'cs'),
(55, 'Rules breaking', 'Porušení pravidel', 'cs'),
(56, 'Spam', 'Rozesílání spamu', 'cs'),
(57, 'Virus', 'Zavirovaný počítač', 'cs'),
(58, 'Redirected', 'Přesměroval', 'cs'),
(59, 'Edited', 'Upravil', 'cs'),
(60, 'Deleted', 'Smazal', 'cs');",

"CREATE TABLE IF NOT EXISTS `ulog2_ct` (
`_ct_id` tinyint(4) DEFAULT NULL,
`orig_ip_saddr` int(10) unsigned DEFAULT NULL,
`orig_ip_daddr` int(10) unsigned DEFAULT NULL,
`orig_ip_protocol` tinyint(3) unsigned DEFAULT NULL,
`orig_l4_sport` smallint(5) unsigned DEFAULT NULL,
`orig_l4_dport` smallint(5) unsigned DEFAULT NULL,
`orig_raw_pktlen` bigint(20) DEFAULT '0',
`orig_raw_pktcount` int(10) unsigned DEFAULT '0',
`reply_ip_daddr` int(10) unsigned DEFAULT NULL,
`reply_l4_dport` smallint(5) unsigned DEFAULT NULL,
`reply_raw_pktlen` bigint(20) DEFAULT '0',
`reply_raw_pktcount` int(10) unsigned DEFAULT '0',
`icmp_code` tinyint(3) DEFAULT NULL,
`icmp_type` tinyint(3) DEFAULT NULL,
`flow_start_sec` int(10) DEFAULT '0',
`flow_end_sec` int(10) DEFAULT '0',
KEY `ct_tuple` (`flow_start_sec`,`orig_ip_daddr`,`orig_l4_dport`,`reply_l4_dport`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;",

"CREATE TABLE IF NOT EXISTS `users` (
`member_id` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(50) COLLATE utf8_czech_ci DEFAULT NULL,
`password` varchar(50) COLLATE utf8_czech_ci DEFAULT NULL,
`password_request` varchar(10) COLLATE utf8_czech_ci DEFAULT NULL,
`name` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`middle_name` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`surname` varchar(60) COLLATE utf8_czech_ci DEFAULT NULL,
`pre_title` varchar(40) COLLATE utf8_czech_ci DEFAULT NULL,
`post_title` varchar(30) COLLATE utf8_czech_ci DEFAULT NULL,
`birthday` date DEFAULT NULL,
`type` tinyint(4) NOT NULL,
`web_messages_types` int(11) DEFAULT NULL,
`email_messages_types` int(11) DEFAULT NULL,
`comment` varchar(250) COLLATE utf8_czech_ci DEFAULT NULL,
`application_password` varchar(50) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`),
KEY `name` (`name`),
KEY `surname` (`surname`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `users_contacts` (
`user_id` int(10) NOT NULL,
`contact_id` int(10) NOT NULL,
`whitelisted` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`,`contact_id`),
KEY `users_contacts_ibfk_2` (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci COMMENT='Pivot table';",

"CREATE TABLE IF NOT EXISTS `users_keys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`key` text COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `variable_symbols` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`variable_symbol` varchar(10) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `variable_symbol` (`variable_symbol`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `vlans` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
`tag_802_1q` int(11) DEFAULT NULL,
`comment` varchar(254) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `tag_802_1q` (`tag_802_1q`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;",

"INSERT INTO `vlans` (`id`, `name`, `tag_802_1q`, `comment`) VALUES
(1, 'Default VLAN', 1, 'Default VLAN');",

"CREATE TABLE IF NOT EXISTS `voip_sips` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`name` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`accountcode` varchar(20) COLLATE utf8_czech_ci DEFAULT NULL,
`amaflags` varchar(13) COLLATE utf8_czech_ci DEFAULT NULL,
`callgroup` varchar(10) COLLATE utf8_czech_ci DEFAULT NULL,
`callerid` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`canreinvite` char(3) COLLATE utf8_czech_ci DEFAULT 'no',
`context` varchar(80) COLLATE utf8_czech_ci DEFAULT 'internal',
`defaultip` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`dtmfmode` varchar(7) COLLATE utf8_czech_ci DEFAULT NULL,
`fromuser` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`fromdomain` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`fullcontact` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`host` varchar(31) COLLATE utf8_czech_ci NOT NULL DEFAULT 'dynamic',
`insecure` varchar(4) COLLATE utf8_czech_ci DEFAULT NULL,
`language` char(2) COLLATE utf8_czech_ci DEFAULT 'cz',
`mailbox` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`md5secret` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`nat` varchar(5) COLLATE utf8_czech_ci NOT NULL DEFAULT 'yes',
`deny` varchar(95) COLLATE utf8_czech_ci DEFAULT NULL,
`permit` varchar(95) COLLATE utf8_czech_ci DEFAULT NULL,
`mask` varchar(95) COLLATE utf8_czech_ci DEFAULT NULL,
`pickupgroup` varchar(10) COLLATE utf8_czech_ci DEFAULT NULL,
`port` varchar(5) COLLATE utf8_czech_ci DEFAULT NULL,
`qualify` char(3) COLLATE utf8_czech_ci DEFAULT NULL,
`restrictcid` char(1) COLLATE utf8_czech_ci DEFAULT NULL,
`rtptimeout` char(3) COLLATE utf8_czech_ci DEFAULT NULL,
`rtpholdtimeout` char(3) COLLATE utf8_czech_ci DEFAULT NULL,
`secret` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`type` varchar(6) COLLATE utf8_czech_ci NOT NULL DEFAULT 'friend',
`username` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`disallow` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`allow` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`musiconhold` varchar(100) COLLATE utf8_czech_ci DEFAULT NULL,
`regseconds` int(11) NOT NULL DEFAULT '0',
`ipaddr` varchar(15) COLLATE utf8_czech_ci NOT NULL,
`regexten` varchar(80) COLLATE utf8_czech_ci NOT NULL,
`cancallforward` char(3) COLLATE utf8_czech_ci DEFAULT 'yes',
`setvar` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`auth` varchar(10) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `voip_voicemail_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
`context` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`mailbox` varchar(10) COLLATE utf8_czech_ci NOT NULL DEFAULT '0',
`password` varchar(4) COLLATE utf8_czech_ci NOT NULL DEFAULT '0',
`fullname` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`email` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`pager` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `customer_id` (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"CREATE TABLE IF NOT EXISTS `votes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL COMMENT 'id of voter',
`type` int(11) NOT NULL COMMENT 'type of vote',
`fk_id` int(11) NOT NULL COMMENT 'id of foreign key',
`aro_group_id` int(11) NOT NULL,
`priority` int(11) NOT NULL,
`vote` tinyint(1) DEFAULT NULL COMMENT 'value of user vote',
`time` datetime NOT NULL,
`comment` mediumtext COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `fk_id` (`fk_id`),
KEY `aro_group_id` (`aro_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",

"ALTER TABLE `accounts`
ADD CONSTRAINT `accounts_ibfk_3` FOREIGN KEY (`comments_thread_id`) REFERENCES `comments_threads` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `accounts_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `accounts_ibfk_2` FOREIGN KEY (`account_attribute_id`) REFERENCES `account_attributes` (`id`);",

"ALTER TABLE `accounts_bank_accounts`
ADD CONSTRAINT `accounts_bank_accounts_ibfk_2` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `accounts_bank_accounts_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `aco_map`
ADD CONSTRAINT `aco_map_ibfk_1` FOREIGN KEY (`acl_id`) REFERENCES `acl` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `address_points`
ADD CONSTRAINT `address_points_ibfk_1` FOREIGN KEY (`street_id`) REFERENCES `streets` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `address_points_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `towns` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `address_points_ibfk_3` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `allowed_subnets`
ADD CONSTRAINT `allowed_subnets_ibfk_2` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `allowed_subnets_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `allowed_subnets_counts`
ADD CONSTRAINT `allowed_subnets_counts_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `approval_template_items`
ADD CONSTRAINT `approval_template_items_ibfk_2` FOREIGN KEY (`approval_type_id`) REFERENCES `approval_types` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `approval_template_items_ibfk_1` FOREIGN KEY (`approval_template_id`) REFERENCES `approval_templates` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `aro_groups_map`
ADD CONSTRAINT `aro_groups_map_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `aro_groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `aro_groups_map_ibfk_1` FOREIGN KEY (`acl_id`) REFERENCES `acl` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `axo_map`
ADD CONSTRAINT `axo_map_ibfk_1` FOREIGN KEY (`acl_id`) REFERENCES `acl` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `bank_accounts`
ADD CONSTRAINT `bank_accounts_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `bank_statements`
ADD CONSTRAINT `bank_statements_ibfk_1` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`),
ADD CONSTRAINT `bank_statements_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `bank_transfers`
ADD CONSTRAINT `bank_transfers_ibfk_1` FOREIGN KEY (`origin_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `bank_transfers_ibfk_2` FOREIGN KEY (`destination_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `bank_transfers_ibfk_3` FOREIGN KEY (`transfer_id`) REFERENCES `transfers` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `bank_transfers_ibfk_4` FOREIGN KEY (`bank_statement_id`) REFERENCES `bank_statements` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `cash`
ADD CONSTRAINT `cash_ibfk_2` FOREIGN KEY (`transfer_id`) REFERENCES `transfers` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `cash_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `clouds_subnets`
ADD CONSTRAINT `clouds_subnets_ibfk_2` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `clouds_subnets_ibfk_1` FOREIGN KEY (`cloud_id`) REFERENCES `clouds` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `clouds_users`
ADD CONSTRAINT `clouds_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `clouds_users_ibfk_1` FOREIGN KEY (`cloud_id`) REFERENCES `clouds` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`comments_thread_id`) REFERENCES `comments_threads` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `contacts_countries`
ADD CONSTRAINT `contacts_countries_ibfk_4` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `contacts_countries_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `contacts_countries_ibfk_2` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `contacts_countries_ibfk_3` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `devices`
ADD CONSTRAINT `devices_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `devices_ibfk_2` FOREIGN KEY (`address_point_id`) REFERENCES `address_points` (`id`);",

"ALTER TABLE `device_admins`
ADD CONSTRAINT `device_admins_ibfk_2` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `device_admins_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `device_engineers`
ADD CONSTRAINT `device_engineers_ibfk_2` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `device_engineers_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `device_templates`
ADD CONSTRAINT `device_templates_ibfk_enum_type` FOREIGN KEY (`enum_type_id`) REFERENCES `enum_types` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `enum_types`
ADD CONSTRAINT `enum_types_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `enum_type_names` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `fees`
ADD CONSTRAINT `fees_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `enum_types` (`id`);",

"ALTER TABLE `groups_aro_map`
ADD CONSTRAINT `groups_aro_map_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `aro_groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `groups_aro_map_ibfk_1` FOREIGN KEY (`aro_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `ifaces`
ADD CONSTRAINT `ifaces_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `ifaces_ibfk_2` FOREIGN KEY (`link_id`) REFERENCES `links` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `ifaces_relationships`
ADD CONSTRAINT `ifaces_relationships_ibfk_2` FOREIGN KEY (`iface_id`) REFERENCES `ifaces` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `ifaces_relationships_ibfk_1` FOREIGN KEY (`parent_iface_id`) REFERENCES `ifaces` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `ifaces_vlans`
ADD CONSTRAINT `ifaces_vlans_ibfk_2` FOREIGN KEY (`vlan_id`) REFERENCES `vlans` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `ifaces_vlans_ibfk_1` FOREIGN KEY (`iface_id`) REFERENCES `ifaces` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `invoices`
ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `invoice_items`
ADD CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `ip_addresses`
ADD CONSTRAINT `ip_addresses_ibfk_6` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `ip_addresses_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `ip_addresses_ibfk_5` FOREIGN KEY (`iface_id`) REFERENCES `ifaces` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `jobs`
ADD CONSTRAINT `jobs_ibfk_7` FOREIGN KEY (`previous_rejected_work_id`) REFERENCES `jobs` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `jobs_ibfk_1` FOREIGN KEY (`job_report_id`) REFERENCES `job_reports` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `jobs_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `jobs_ibfk_3` FOREIGN KEY (`added_by_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `jobs_ibfk_4` FOREIGN KEY (`approval_template_id`) REFERENCES `approval_templates` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `jobs_ibfk_5` FOREIGN KEY (`transfer_id`) REFERENCES `transfers` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `jobs_ibfk_6` FOREIGN KEY (`comments_thread_id`) REFERENCES `comments_threads` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `job_reports`
ADD CONSTRAINT `job_reports_ibfk_5` FOREIGN KEY (`transfer_id`) REFERENCES `transfers` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `job_reports_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `job_reports_ibfk_2` FOREIGN KEY (`approval_template_id`) REFERENCES `approval_templates` (`id`),
ADD CONSTRAINT `job_reports_ibfk_4` FOREIGN KEY (`added_by_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `login_logs`
ADD CONSTRAINT `login_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `mail_messages`
ADD CONSTRAINT `mail_messages_ibfk_2` FOREIGN KEY (`to_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `mail_messages_ibfk_1` FOREIGN KEY (`from_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `members`
ADD CONSTRAINT `members_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `members_ibfk_2` FOREIGN KEY (`address_point_id`) REFERENCES `address_points` (`id`);",

"ALTER TABLE `membership_interrupts`
ADD CONSTRAINT `membership_interrupts_ibfk_2` FOREIGN KEY (`members_fee_id`) REFERENCES `members_fees` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `membership_interrupts_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `members_domiciles`
ADD CONSTRAINT `members_domiciles_ibfk_2` FOREIGN KEY (`address_point_id`) REFERENCES `address_points` (`id`),
ADD CONSTRAINT `members_domiciles_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `members_fees`
ADD CONSTRAINT `members_fees_ibfk_2` FOREIGN KEY (`fee_id`) REFERENCES `fees` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `members_fees_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `members_traffics`
ADD CONSTRAINT `members_traffics_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `messages_ip_addresses`
ADD CONSTRAINT `messages_ip_addresses_ibfk_5` FOREIGN KEY (`ip_address_id`) REFERENCES `ip_addresses` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `messages_ip_addresses_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `messages` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `messages_ip_addresses_ibfk_2` FOREIGN KEY (`ip_address_id`) REFERENCES `ip_addresses` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `messages_ip_addresses_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `messages_ip_addresses_ibfk_4` FOREIGN KEY (`message_id`) REFERENCES `messages` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `monitor_hosts`
ADD CONSTRAINT `monitor_hosts_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_calls`
ADD CONSTRAINT `phone_calls_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_calls_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_connections`
ADD CONSTRAINT `phone_connections_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_connections_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_fixed_calls`
ADD CONSTRAINT `phone_fixed_calls_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_fixed_calls_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_invoice_users`
ADD CONSTRAINT `phone_invoice_users_ibfk_4` FOREIGN KEY (`transfer_id`) REFERENCES `transfers` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `phone_invoice_users_ibfk_1` FOREIGN KEY (`phone_invoice_id`) REFERENCES `phone_invoices` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_invoice_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_invoice_users_ibfk_3` FOREIGN KEY (`phone_invoice_id`) REFERENCES `phone_invoices` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_operators`
ADD CONSTRAINT `phone_operators_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_operator_prefixes`
ADD CONSTRAINT `phone_operator_prefixes_ibfk_1` FOREIGN KEY (`phone_operator_id`) REFERENCES `phone_operators` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_pays`
ADD CONSTRAINT `phone_pays_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_pays_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_roaming_sms_messages`
ADD CONSTRAINT `phone_roaming_sms_messages_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_roaming_sms_messages_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_sms_messages`
ADD CONSTRAINT `phone_sms_messages_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_sms_messages_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `phone_vpn_calls`
ADD CONSTRAINT `phone_vpn_calls_ibfk_2` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `phone_vpn_calls_ibfk_1` FOREIGN KEY (`phone_invoice_user_id`) REFERENCES `phone_invoice_users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `private_users_contacts`
ADD CONSTRAINT `private_users_contacts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `private_users_contacts_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `sms_messages`
ADD CONSTRAINT `sms_messages_ibfk_2` FOREIGN KEY (`sms_message_id`) REFERENCES `sms_messages` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `sms_messages_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `streets`
ADD CONSTRAINT `streets_ibfk_1` FOREIGN KEY (`town_id`) REFERENCES `towns` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `subnets_owners`
ADD CONSTRAINT `subnets_owners_ibfk_2` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `subnets_owners_ibfk_1` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `transfers`
ADD CONSTRAINT `transfers_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `transfers_ibfk_1` FOREIGN KEY (`origin_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `transfers_ibfk_2` FOREIGN KEY (`destination_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `transfers_ibfk_3` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE SET NULL;",

"ALTER TABLE `users`
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `users_contacts`
ADD CONSTRAINT `users_contacts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `users_contacts_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `users_keys`
ADD CONSTRAINT `users_keys_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `variable_symbols`
ADD CONSTRAINT `variable_symbols_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `voip_sips`
ADD CONSTRAINT `voip_sips_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;",

"ALTER TABLE `votes`
ADD CONSTRAINT `votes_ibfk_3` FOREIGN KEY (`aro_group_id`) REFERENCES `aro_groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `votes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `votes_ibfk_2` FOREIGN KEY (`fk_id`) REFERENCES `jobs` (`id`) ON DELETE CASCADE;",

"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;",
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;",
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;"
);