SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

/*!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 DATABASE IF NOT EXISTS `svt_user` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `svt_user`;

DROP TABLE IF EXISTS `svtuser_cartridge`;
CREATE TABLE IF NOT EXISTS `svtuser_cartridge` (
  `cartridge_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_id` int(11) DEFAULT NULL,
  `organiz_id` int(11) DEFAULT NULL,
  `cartridge_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cartridge_serialnum` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cartridgetype_id` int(11) DEFAULT NULL,
  `cartridge_writeoff` tinyint(3) DEFAULT NULL,
  `cartridge_note` text COLLATE utf8_unicode_ci,
  `cartridge_loaddate` datetime DEFAULT NULL,
  `cartridge_buydate` datetime DEFAULT NULL,
  PRIMARY KEY (`cartridge_id`),
  KEY `svt_id` (`svt_id`),
  KEY `organiz_id` (`organiz_id`),
  KEY `cartridgetype_id` (`cartridgetype_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_cartridgetype`;
CREATE TABLE IF NOT EXISTS `svtuser_cartridgetype` (
  `cartridgetype_id` int(11) NOT NULL AUTO_INCREMENT,
  `cartridgetype_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cartridgetype_partcode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cartridgetype_numprintlist` int(11) DEFAULT NULL,
  `cartridgetype_writeoff` int(11) DEFAULT NULL,
  PRIMARY KEY (`cartridgetype_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=30 ;

INSERT INTO `svtuser_cartridgetype` (`cartridgetype_id`, `cartridgetype_name`, `cartridgetype_partcode`, `cartridgetype_numprintlist`, `cartridgetype_writeoff`) VALUES
(1, '53x', 'Q7553X', 7000, 7),
(2, '92A', 'C4092A', 2500, 7),
(3, '27X', 'C4127X', 10000, 7),
(4, '45A', '51645A', 1860, 0),
(5, '78D', 'C6578D', 900, 0),
(6, '78A', 'C6578A', 970, 0),
(7, '61X', 'C8061X', 10000, 7),
(8, '15X', 'C7115X', 3500, 7),
(9, '13X', 'Q2613X', 4000, 7),
(10, '38A', 'Q1338A', 12000, 7),
(11, '28A', 'C8728A', 190, 0),
(12, '57A', 'C6657A', 500, 0),
(13, '27A', 'C8727A', 220, 0),
(14, '49X', 'Q5949X', 4000, 7),
(15, '11A', 'Q6511A', 6000, 7),
(16, '42A', 'Q5942A', 10000, 7),
(18, '38HE', 'CB338HE', 580, 0),
(19, '36HE', 'CB336HE', 1000, 0),
(20, '30A', 'C9730A', 13000, 0),
(21, '31A', 'C9731A', 12000, 0),
(22, '33A', 'C9733A', 12000, 0),
(23, '32A', 'C9732A', 12000, 0),
(24, '36A', 'CB436A', 2000, 7),
(25, '66HE', 'C8766HE', 330, 0),
(26, '64HE', 'C9364HE', 800, 0),
(27, '49A', 'CE749A', 7000, 7),
(28, '59A', 'CE459A', 7000, 7),
(29, '38A', 'CE538A', 7000, 7);

DROP TABLE IF EXISTS `svtuser_config`;
CREATE TABLE IF NOT EXISTS `svtuser_config` (
  `config_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `config_var` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
  `config_value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `config_access` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AVG_ROW_LENGTH=79;

INSERT INTO `svtuser_config` (`config_name`, `config_var`, `config_value`, `config_access`) VALUES
('Заголовок окна', 'title', 'Supporti', NULL),
('Язык по умолчанию', 'DefaultLangName', 'ru', NULL),
('Кодировка сайта', 'charset', 'utf-8', NULL),
('Папка с текстами', 'FolderText', 'html', NULL),
('Посылать информацию о заявке пользователям', 'SendDemandsToUsersFlag', '1', NULL),
('Папка с отчетами', 'FolderReport', '/files/DATA/', NULL),
('Посылать информацию о заявке системным инженерам', 'SendDemandsToOperatorsFlag', '1', NULL),
('E-mail отправитель уведомлений о заявке для операторов', 'SendDemandsToOperatorsFrom', 'test@supporti.ru', NULL),
('Тема e-mail уведомлений о заявке для операторов', 'SendDemandsToOperatorsSubject', 'New Svt Demand', NULL),
('Адрес MailServer', 'AddressMailServer', '', NULL),
('Временная зона', 'TimeZone', 'Europe/Moskow', NULL),
('Лицензии ПО, время оповещения', 'LicPoDeadLine', '6', NULL),
('Закупки, время оповещения', 'PurchaseDeadLine', '3', NULL),
('Оформление заявки без авторизации', 'DemandsWithoutAuth', '1', NULL),
('Размер картинки QR-кода', 'QrCodesize', '100', NULL);

DROP TABLE IF EXISTS `svtuser_demands`;
CREATE TABLE IF NOT EXISTS `svtuser_demands` (
  `demands_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_id` int(11) DEFAULT NULL,
  `demands_date` datetime DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  `demands_ip` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `demands_masterid` int(11) DEFAULT NULL,
  `sprstatus_id` int(11) DEFAULT NULL,
  `demandsclassif_id` int(11) DEFAULT NULL,
  `demands_statusdate` datetime DEFAULT NULL,
  `demands_intdocnum` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `demands_intdocdate` datetime DEFAULT NULL,
  PRIMARY KEY (`demands_id`),
  KEY `svt_id` (`svt_id`),
  KEY `users_id` (`users_id`),
  KEY `demands_masterid` (`demands_masterid`),
  KEY `sprstatus_id` (`sprstatus_id`),
  KEY `demandsclassif_id` (`demandsclassif_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_demandsclassif`;
CREATE TABLE IF NOT EXISTS `svtuser_demandsclassif` (
  `demandsclassif_id` int(11) NOT NULL AUTO_INCREMENT,
  `demandsclassif_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `demandsclassif_order` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`demandsclassif_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=465 ;

INSERT INTO `svtuser_demandsclassif` (`demandsclassif_id`, `demandsclassif_name`, `demandsclassif_order`) VALUES
(462, 'Hardware', 2),
(463, 'Software', 1),
(464, 'По вине пользователя', 3);

DROP TABLE IF EXISTS `svtuser_demandscomments`;
CREATE TABLE IF NOT EXISTS `svtuser_demandscomments` (
  `demandscomments_id` int(11) NOT NULL AUTO_INCREMENT,
  `demandscommentsparent_id` int(11) DEFAULT NULL,
  `demands_id` int(11) DEFAULT NULL,
  `demandscomments_comment` text COLLATE utf8_unicode_ci,
  `demandscomments_date` datetime DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  `demandscomments_ip` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`demandscomments_id`),
  KEY `demands_id` (`demands_id`),
  KEY `users_id` (`users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_ip`;
CREATE TABLE IF NOT EXISTS `svtuser_ip` (
  `ip_id` int(11) NOT NULL AUTO_INCREMENT,
  `ip_name` char(15) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svt_id` int(11) DEFAULT NULL,
  `ip_note` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`ip_id`),
  KEY `svt_id` (`svt_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_organiz`;
CREATE TABLE IF NOT EXISTS `svtuser_organiz` (
  `organiz_id` int(11) NOT NULL AUTO_INCREMENT,
  `organiz_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `organiz_note` text COLLATE utf8_unicode_ci,
  `organiz_address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `organiz_tel` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `organiz_fax` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `organiz_person` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `organiz_persontel` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`organiz_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_pass`;
CREATE TABLE IF NOT EXISTS `svtuser_pass` (
  `pass_id` int(11) NOT NULL AUTO_INCREMENT,
  `users_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pass_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pass_login` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pass_pass` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pass_note` text COLLATE utf8_unicode_ci,
  `pass_date` datetime DEFAULT NULL,
  `pass_share` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`pass_id`),
  KEY `users_id` (`users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_po`;
CREATE TABLE IF NOT EXISTS `svtuser_po` (
  `po_id` int(11) NOT NULL AUTO_INCREMENT,
  `po_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `po_note` text COLLATE utf8_unicode_ci,
  `po_date` datetime DEFAULT NULL,
  PRIMARY KEY (`po_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_policence`;
CREATE TABLE IF NOT EXISTS `svtuser_policence` (
  `policence_id` int(11) NOT NULL AUTO_INCREMENT,
  `po_id` int(11) DEFAULT NULL,
  `organiz_id` int(11) DEFAULT NULL,
  `policence_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `policence_number` int(11) DEFAULT NULL,
  `policence_note` text COLLATE utf8_unicode_ci,
  `policence_dateb` datetime DEFAULT NULL,
  `policence_datee` datetime DEFAULT NULL,
  PRIMARY KEY (`policence_id`),
  KEY `po_id` (`po_id`),
  KEY `organiz_id` (`organiz_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_purchase`;
CREATE TABLE IF NOT EXISTS `svtuser_purchase` (
  `purchase_id` int(11) NOT NULL AUTO_INCREMENT,
  `structureorganization_id` int(11) DEFAULT NULL,
  `purchasestatus_id` int(11) DEFAULT NULL,
  `purchase_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `purchase_price` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `purchase_quantity` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `purchase_datetill` datetime DEFAULT NULL,
  `purchase_date` datetime DEFAULT NULL,
  `purchase_note` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`purchase_id`),
  KEY `structureorganization_id` (`structureorganization_id`),
  KEY `purchasestatus_id` (`purchasestatus_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_purchasestatus`;
CREATE TABLE IF NOT EXISTS `svtuser_purchasestatus` (
  `purchasestatus_id` int(11) NOT NULL AUTO_INCREMENT,
  `purchasestatus_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `purchasestatus_color` char(7) COLLATE utf8_unicode_ci DEFAULT NULL,
  `purchasestatus_order` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`purchasestatus_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

INSERT INTO `svtuser_purchasestatus` (`purchasestatus_id`, `purchasestatus_name`, `purchasestatus_color`, `purchasestatus_order`) VALUES
(1, 'заявка', '#ff0000', 1),
(2, 'выполнено', '#00ff00', 2);

DROP TABLE IF EXISTS `svtuser_repair`;
CREATE TABLE IF NOT EXISTS `svtuser_repair` (
  `repair_id` int(11) NOT NULL AUTO_INCREMENT,
  `demands_id` int(11) DEFAULT NULL,
  `organiz_id` int(11) DEFAULT NULL,
  `repairstatus_id` int(11) DEFAULT NULL,
  `repair_summa` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL,
  `repair_content` text COLLATE utf8_unicode_ci,
  `repair_numdoc` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `repair_numdocdate` datetime DEFAULT NULL,
  `repair_date_b` datetime DEFAULT NULL,
  `repair_date_e` datetime DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`repair_id`),
  KEY `demands_id` (`demands_id`),
  KEY `organiz_id` (`organiz_id`),
  KEY `repairstatus_id` (`repairstatus_id`),
  KEY `users_id` (`users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_repairstatus`;
CREATE TABLE IF NOT EXISTS `svtuser_repairstatus` (
  `repairstatus_id` int(11) NOT NULL AUTO_INCREMENT,
  `repairstatus_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `repairstatus_color` char(7) COLLATE utf8_unicode_ci DEFAULT NULL,
  `repairstatus_order` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`repairstatus_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

INSERT INTO `svtuser_repairstatus` (`repairstatus_id`, `repairstatus_name`, `repairstatus_color`, `repairstatus_order`) VALUES
(2, 'Выполняется', '#ff0000', 1),
(1, 'Выполнено', '#00ff00', 2);

DROP TABLE IF EXISTS `svtuser_sprstatus`;
CREATE TABLE IF NOT EXISTS `svtuser_sprstatus` (
  `sprstatus_id` int(11) NOT NULL AUTO_INCREMENT,
  `sprstatus_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `sprstatus_color` char(7) COLLATE utf8_unicode_ci DEFAULT NULL,
  `sprstatus_order` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`sprstatus_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=462 ;

INSERT INTO `svtuser_sprstatus` (`sprstatus_id`, `sprstatus_name`, `sprstatus_color`, `sprstatus_order`) VALUES
(1, 'заявка', '#ff0000', 1),
(2, 'отложено', '#ffff00', 3),
(3, 'выполнено', '#00ff00', 5),
(4, 'выполняется', '#00ffff', 2),
(458, 'наблюдается', '#0000ff', 4);

DROP TABLE IF EXISTS `svtuser_structureorganization`;
CREATE TABLE IF NOT EXISTS `svtuser_structureorganization` (
  `structureorganization_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `structureorganization_parent_id` bigint(20) unsigned NOT NULL,
  `structureorganization_position` bigint(20) unsigned NOT NULL,
  `structureorganization_title` text COLLATE utf8_unicode_ci,
  `structureorganization_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `structureorganization_userip` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `structureorganization_date` datetime DEFAULT NULL,
  PRIMARY KEY (`structureorganization_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AVG_ROW_LENGTH=69 AUTO_INCREMENT=2 ;

INSERT INTO `svtuser_structureorganization` (`structureorganization_id`, `structureorganization_parent_id`, `structureorganization_position`, `structureorganization_title`, `structureorganization_type`, `structureorganization_userip`, `structureorganization_date`) VALUES
(1, 0, 0, 'Организация', 'default', '127.0.0.1', '2012-10-31 17:41:48');

DROP TABLE IF EXISTS `svtuser_svt`;
CREATE TABLE IF NOT EXISTS `svtuser_svt` (
  `svt_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svt_buxname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svt_invnum` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svt_serialnum` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svt_garant_date` datetime DEFAULT NULL,
  `structureorganization_id` int(11) DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  `svttype_id` int(11) DEFAULT NULL,
  `organiz_id` int(11) DEFAULT NULL,
  `svt_note` text COLLATE utf8_unicode_ci,
  `svt_date` datetime DEFAULT NULL,
  PRIMARY KEY (`svt_id`),
  KEY `structureorganization_id` (`structureorganization_id`),
  KEY `users_id` (`users_id`),
  KEY `svttype_id` (`svttype_id`),
  KEY `organiz_id` (`organiz_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_svtgiveout`;
CREATE TABLE IF NOT EXISTS `svtuser_svtgiveout` (
  `svtgiveout_id` int(11) NOT NULL AUTO_INCREMENT,
  `demands_masterid` int(11) DEFAULT NULL,
  `svt_id` int(11) DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  `svtgiveoutstatus_id` int(11) DEFAULT NULL,
  `svtgiveout_note` text COLLATE utf8_unicode_ci,
  `svtgiveout_date_b` datetime DEFAULT NULL,
  `svtgiveout_date_e` datetime DEFAULT NULL,
  `svtgiveout_date` datetime DEFAULT NULL,
  PRIMARY KEY (`svtgiveout_id`),
  KEY `demands_masterid` (`demands_masterid`),
  KEY `svt_id` (`svt_id`),
  KEY `users_id` (`users_id`),
  KEY `svtgiveoutstatus_id` (`svtgiveoutstatus_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AVG_ROW_LENGTH=50 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_svtgiveoutstatus`;
CREATE TABLE IF NOT EXISTS `svtuser_svtgiveoutstatus` (
  `svtgiveoutstatus_id` int(11) NOT NULL AUTO_INCREMENT,
  `svtgiveoutstatus_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svtgiveoutstatus_color` char(7) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svtgiveoutstatus_order` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`svtgiveoutstatus_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;

INSERT INTO `svtuser_svtgiveoutstatus` (`svtgiveoutstatus_id`, `svtgiveoutstatus_name`, `svtgiveoutstatus_color`, `svtgiveoutstatus_order`) VALUES
(1, 'Выдан', '#ff0000', 1),
(2, 'Возвращен', '#00ff00', 3),
(3, 'Зарезервирован', '#ffff00', 2);

DROP TABLE IF EXISTS `svtuser_svtmove`;
CREATE TABLE IF NOT EXISTS `svtuser_svtmove` (
  `svtmove_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_id` int(11) NOT NULL,
  `structureorganization_id_from` int(11) DEFAULT NULL,
  `structureorganization_id_to` int(11) DEFAULT NULL,
  `users_id_from` int(11) DEFAULT NULL,
  `users_id_to` int(11) DEFAULT NULL,
  `svtmove_note` text COLLATE utf8_unicode_ci,
  `svtmove_date` datetime NOT NULL,
  `svtmove_is_deleted` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`svtmove_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_svtpo`;
CREATE TABLE IF NOT EXISTS `svtuser_svtpo` (
  `svtpo_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_id` int(11) DEFAULT NULL,
  `po_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`svtpo_id`),
  KEY `svt_id` (`svt_id`),
  KEY `po_id` (`po_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_svtstatus`;
CREATE TABLE IF NOT EXISTS `svtuser_svtstatus` (
  `svtstatus_id` int(11) NOT NULL AUTO_INCREMENT,
  `svtstatus_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svtstatus_main` tinyint(1) NOT NULL,
  PRIMARY KEY (`svtstatus_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=466 ;

INSERT INTO `svtuser_svtstatus` (`svtstatus_id`, `svtstatus_name`, `svtstatus_main`) VALUES
(1, 'На балансе', 0),
(2, 'Списан', 0),
(462, 'Проблемный', 0),
(463, 'Не используется', 0),
(464, 'На списание', 0);

DROP TABLE IF EXISTS `svtuser_svtstatusval`;
CREATE TABLE IF NOT EXISTS `svtuser_svtstatusval` (
  `svtstatusval_id` int(11) NOT NULL AUTO_INCREMENT,
  `svt_id` int(11) DEFAULT NULL,
  `svtstatus_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`svtstatusval_id`),
  KEY `svt_id` (`svt_id`),
  KEY `svtstatus_id` (`svtstatus_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `svtuser_svttype`;
CREATE TABLE IF NOT EXISTS `svtuser_svttype` (
  `svttype_id` int(11) NOT NULL AUTO_INCREMENT,
  `svttype_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `svttype_writeoff` tinyint(3) DEFAULT NULL,
  PRIMARY KEY (`svttype_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=500 ;

INSERT INTO `svtuser_svttype` (`svttype_id`, `svttype_name`, `svttype_writeoff`) VALUES
(455, 'ПЭВМ', 10),
(456, 'Принтеры', 10),
(457, 'Сканеры', 10),
(460, 'Мониторы', 10),
(461, 'Серверы', 10),
(462, 'Сетевое', 10),
(463, 'Ноутбуки', 10),
(465, 'Проекторы', 10),
(464, 'ИБП', 10),
(497, 'Комплектующие', 10);

DROP TABLE IF EXISTS `svtuser_users`;
CREATE TABLE IF NOT EXISTS `svtuser_users` (
  `users_id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `structureorganization_id` int(11) DEFAULT NULL,
  `users_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `users_password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `users_passclean` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_fio` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_tel` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_telint` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_telcell` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_jobtitle` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_numofice` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_lastip` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_lasttime` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_previp` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_prevtime` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `users_status` tinyint(1) NOT NULL,
  PRIMARY KEY (`users_id`),
  KEY `structureorganization_id` (`structureorganization_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2219 ;

INSERT INTO `svtuser_users` (`users_id`, `group_id`, `structureorganization_id`, `users_name`, `users_password`, `users_passclean`, `users_fio`, `users_note`, `users_tel`, `users_telint`, `users_telcell`, `users_email`, `users_jobtitle`, `users_numofice`, `users_lastip`, `users_lasttime`, `users_previp`, `users_prevtime`, `users_status`) VALUES
(1, 2, 1, 'test@supporti.ru', 'c26820b8a4c1b3c2aa868d6d57e14a79', '1357', 'Supporti Иван Иванович', NULL, '', '', NULL, 'test@supporti.ru', '', '', '127.0.0.1', '20140201120646', '127.0.0.1', '20140201120645', 1);

DROP TABLE IF EXISTS `svtuser_usersprefvalue`;
CREATE TABLE IF NOT EXISTS `svtuser_usersprefvalue` (
  `usersprefvalue_id` int(11) NOT NULL AUTO_INCREMENT,
  `users_id` int(11) DEFAULT NULL,
  `userspref_id` int(11) DEFAULT NULL,
  `usersprefvalue_value` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`usersprefvalue_id`),
  KEY `users_id` (`users_id`),
  KEY `userspref_id` (`userspref_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

INSERT INTO `svtuser_usersprefvalue` (`usersprefvalue_id`, `users_id`, `userspref_id`, `usersprefvalue_value`) VALUES
(1, 1, 1, 'blitzer');

DROP TABLE IF EXISTS `svtuser_usersservices`;
CREATE TABLE IF NOT EXISTS `svtuser_usersservices` (
  `usersservices_id` int(11) NOT NULL AUTO_INCREMENT,
  `users_id` int(11) DEFAULT NULL,
  `webservices_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`usersservices_id`),
  KEY `users_id` (`users_id`),
  KEY `webservices_id` (`webservices_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

INSERT INTO `svtuser_usersservices` (`usersservices_id`, `users_id`, `webservices_id`) VALUES
(1, 1, 1);

DROP TABLE IF EXISTS `svtuser_userssettingsvalue`;
CREATE TABLE IF NOT EXISTS `svtuser_userssettingsvalue` (
  `userssettingsvalue_id` int(11) NOT NULL AUTO_INCREMENT,
  `users_id` int(11) DEFAULT NULL,
  `userssettingsvalue_var` varchar(255) DEFAULT NULL,
  `userssettingsvalue_value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`userssettingsvalue_id`),
  KEY `users_id` (`users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

/*!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 */;
