core/set/install/install_mysql.php

204 lines
5.9 KiB
PHP

<?php
/*
mysql -u admin -p tk-ligat < adminer.sql
*/
\DB::set("CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`login` varchar(50) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`pwd` varchar(50) DEFAULT NULL,
`act` tinyint(1) DEFAULT 1,
`actcode` varchar(10) DEFAULT NULL,
`site` varchar(256) DEFAULT NULL,
`ip` varchar(256) DEFAULT NULL,
`regdata` varchar(256) DEFAULT NULL,
`lostdata` varchar(256) DEFAULT NULL,
`ref` int(10) DEFAULT NULL,
`repa` int(10) DEFAULT NULL,
`reg_ip` varchar(20) DEFAULT NULL,
`ava` varchar(20) DEFAULT NULL,
`balans` longtext DEFAULT NULL,
`pd` varchar(1) DEFAULT NULL,
`yad` longtext DEFAULT NULL,
`qiwi` longtext DEFAULT NULL,
`fio` varchar(255) DEFAULT NULL,
`tel` varchar(255) DEFAULT NULL,
`adres` varchar(255) DEFAULT NULL,
`org` varchar(255) DEFAULT NULL,
`dostup` varchar(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
\DB::set("ALTER TABLE `users` ADD `dostup` varchar(1) COLLATE 'utf8_general_ci' NULL;");
\DB::set("CREATE TABLE IF NOT EXISTS `site_speed` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`t` varchar(40) DEFAULT NULL,
`mod` varchar(20) DEFAULT NULL,
`mod_id` varchar(20) DEFAULT NULL,
`speed` double DEFAULT NULL,
`user_id` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
\DB::set("CREATE TABLE IF NOT EXISTS `pages` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(250) DEFAULT NULL,
`txt` longtext DEFAULT NULL,
`t` varchar(30) DEFAULT NULL,
`keywords` text DEFAULT NULL,
`alias` varchar(200) DEFAULT NULL,
`description` text DEFAULT NULL,
`status` int(1) DEFAULT NULL,
`category` int(10) DEFAULT NULL,
`user_id` int(10) DEFAULT NULL,
`d` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `pages_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
\DB::set("CREATE TABLE IF NOT EXISTS `pages_category` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(250) DEFAULT NULL,
`keywords` text DEFAULT NULL,
`description` text DEFAULT NULL,
`status` int(1) DEFAULT 1,
`category` int(10) DEFAULT NULL,
`user_id` int(10) DEFAULT NULL,
`reyt` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `pages_category_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_otzyv` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user_id` int(10) NOT NULL,
`t` varchar(30) NOT NULL,
`txt` longtext NOT NULL,
`tovar_id` int(10) NOT NULL,
`status` int(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `tovar_id` (`tovar_id`),
CONSTRAINT `tovar_otzyv_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `tovar_otzyv_ibfk_4` FOREIGN KEY (`tovar_id`) REFERENCES `tovar` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
/*
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_history` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`session_id` varchar(30) DEFAULT NULL,
`tovar_id` int(10) DEFAULT NULL,
`t` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tovar_id` (`tovar_id`),
CONSTRAINT `tovar_history_ibfk_1` FOREIGN KEY (`tovar_id`) REFERENCES `tovar` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar` (
`id` int(10)NULL,
`title` varchar(300) NULL,
`txt` longtext NULL,
`keywords` longtext NULL,
`artikul` varchar(50) NULL,
`description` longtext NULL,
`tovar_id_1c` varchar(100) NULL,
`tovar_cat_1c` varchar(100) NULL,
`status` int(1)NULL,
`category` int(10)NULL,
`countImg` int(2)NULL,
`partner` varchar(100) NULL,
`json` longtext NULL,
`brand_id` int(10)NULL,
`check_img` int(1)NULL,
`code` varchar(30) NULL);");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_img` (
`id` int(10)NULL,
`filename` varchar(30) NULL,
`tovar_id` int(10)NULL,
`md5` varchar(30) NULL,
`title` varchar(300) NULL,
`alt` varchar(300) NULL);");
\DB::set("CREATE TABLE IF NOT EXISTS `blog_category` (
`id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(250) NULL,
`keywords` longtext NULL,
`description` varchar(250) NULL,
`status` int NULL,
`category` int NULL,
`user_id` int(10) NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';");
\DB::set("CREATE TABLE IF NOT EXISTS `blog` (
`id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(250) NULL,
`txt` longtext NULL,
`t` varchar(20) NULL,
`keywords` longtext NULL,
`description` varchar(250) NULL,
`alias` varchar(250) NULL,
`status` int(1) NULL,
`category` int(10) NULL,
`user_id` int(10) NULL,
`reyt` int(10) NULL DEFAULT '0',
FOREIGN KEY (`category`) REFERENCES `blog_category` (`id`),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';");
\DB::set("CREATE TABLE IF NOT EXISTS `page_category` (
`id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(250) NULL,
`keywords` longtext NULL,
`description` varchar(250) NULL,
`status` int NULL,
`category` int NULL,
`user_id` int(10) NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';");
\DB::set("CREATE TABLE IF NOT EXISTS `page` (
`id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(250) NULL,
`txt` longtext NULL,
`t` varchar(20) NULL,
`alias` varchar(250) NULL,
`keywords` longtext NULL,
`description` varchar(250) NULL,
`status` int(1) NULL,
`category` int(10) NULL,
`user_id` int(10) NULL,
`reyt` int(10) NULL DEFAULT '0',
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';");
*/