core/set/install/install_sqlite3.php

305 lines
7.7 KiB
PHP

<?php
\DB::set("CREATE TABLE IF NOT EXISTS `site_speed` (
`id` INTEGER PRIMARY KEY NOT NULL,
`t` TEXT,
`mod` TEXT,
`mod_id` TEXT,
`user_id` TEXT,
`speed` TEXT)");
\DB::set("CREATE TABLE IF NOT EXISTS `sitemap` (
`id` INTEGER PRIMARY KEY NOT NULL,
`t` TEXT,
`link` TEXT,
`status` TEXT)");
\DB::set("CREATE TABLE IF NOT EXISTS `users` (
`id` INTEGER PRIMARY KEY NOT NULL,
`login` TEXT,
`email` TEXT,
`pwd` TEXT,
`act` TEXT,
`actcode` TEXT,
`lostdata` TEXT,
`ref` TEXT,
`ava` TEXT,
`balans` TEXT,
`fio` TEXT,
`about` TEXT,
`reyt` TEXT,
`tip` TEXT,
`dostup` TEXT,
`resurs` TEXT
)");
\DB::set("CREATE TABLE IF NOT EXISTS `tasks` (
`id` INTEGER PRIMARY KEY NOT NULL,
`user_id` INTEGER,
`isp_id` INTEGER,
`mod` TEXT,
`task` TEXT,
`t` TEXT,
`srok` TEXT,
`status` INTEGER,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), FOREIGN KEY (`isp_id`) REFERENCES `users` (`id`) )");
\DB::set("CREATE TABLE IF NOT EXISTS 'docs' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 't' TEXT, 'tip' TEXT, 'json' TEXT, 'user_id' INTEGER, `status` INTEGER, `comment` TEXT)");
\DB::set("CREATE TABLE IF NOT EXISTS `userOption` (
`id` INTEGER PRIMARY KEY NOT NULL,
`user_id` INTEGER,
`perevozka` INTEGER,
`remont` INTEGER,
`opt` INTEGER,
`roznica` INTEGER,
`proizv` INTEGER,
`org` INTEGER,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `settings` (
`id` INTEGER PRIMARY KEY NOT NULL,
`mod` TEXT,
`json` TEXT,
`resurs` TEXT
)");
\DB::set("CREATE TABLE IF NOT EXISTS `meta` (
`id` INTEGER,
`mod` TEXT,
`keywords` TEXT,
`description` TEXT
)");
\DB::set("CREATE TABLE IF NOT EXISTS `strana` (
`id` INTEGER PRIMARY KEY NOT NULL,
`txt` TEXT
);");
\DB::set("CREATE TABLE IF NOT EXISTS `region` (
`id` INTEGER PRIMARY KEY NOT NULL,
`region` TEXT,
`strana_id` INTEGER,
FOREIGN KEY (`strana_id`) REFERENCES `strana` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `city` (
`id` INTEGER PRIMARY KEY NOT NULL,
`city` TEXT,
`region_id` INTEGER,
`strana_id` INTEGER,
FOREIGN KEY (`strana_id`) REFERENCES `strana` (`id`),
FOREIGN KEY (`region_id`) REFERENCES `region` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `blog_category` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`keywords` TEXT,
`description` TEXT,
`status` TEXT,
`category` INTEGER,
`user_id` TEXT,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `blog` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`txt` TEXT,
`t` TEXT,
`keywords` TEXT,
`alias` TEXT,
`description` TEXT,
`status` TEXT,
`category` INTEGER,
`user_id` INTEGER,
`reyt` INTEGER,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `pages_category` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`status` TEXT,
`category` INTEGER,
`user_id` INTEGER,
`reyt` INTEGER,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `pages_category_img` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`img` TEXT,
`original` TEXT,
`status` TEXT,
`category` INTEGER,
`user_id` INTEGER,
FOREIGN KEY (`category`) REFERENCES `pages_category` (`id`),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
);");
\DB::set("CREATE TABLE IF NOT EXISTS `pages` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`txt` TEXT,
`t` TEXT,
`alias` TEXT,
`status` TEXT,
`category` INTEGER,
`user_id` INTEGER,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `org` (
`id` INTEGER PRIMARY KEY NOT NULL,
`txt` TEXT,
`inn` TEXT,
`vid` TEXT,
`kpp` TEXT,
`ogrn` TEXT
);");
\DB::set("CREATE TABLE IF NOT EXISTS `markets` (
`id` INTEGER PRIMARY KEY NOT NULL,
`txt` TEXT,
`tip` TEXT,
`city_id` INTEGER,
`org_id` INTEGER,
`dom` TEXT,
`dostavka` INTEGER,
FOREIGN KEY (`city_id`) REFERENCES `city` (`city`),
FOREIGN KEY (`org_id`) REFERENCES `org` (`city`));");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`txt` TEXT,
`keywords` TEXT,
`artikul` TEXT,
`description` TEXT,
`tovar_id_1c` TEXT,
`tovar_cat_1c` TEXT,
`status` INTEGER,
`category` INTEGER ,
`countImg` INTEGER,
`partner` INTEGER,
`json` TEXT,
`brand_id` INTEGER,
`check_img` INTEGER,
`code` TEXT);");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_category` (
`id` INTEGER PRIMARY KEY NOT NULL,
`title` TEXT,
`description` TEXT,
`keywords` TEXT,
`status` INTEGER,
`category` INTEGER );");
\DB::set("CREATE TABLE IF NOT EXISTS `zametka` ( `user_id` INTEGER NOT NULL, `txt` TEXT, FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) )");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_category_img` (
`id` INTEGER PRIMARY KEY NOT NULL,
`filename` TEXT,
`tovar_category_id` INTEGER,
`md5` TEXT,
`title` TEXT,
`alt` TEXT,
FOREIGN KEY (`tovar_category_id`) REFERENCES `tovar_category` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_img` (
`id` INTEGER PRIMARY KEY NOT NULL,
`filename` TEXT,
`tovar_id` INTEGER,
`md5` TEXT,
`title` TEXT,
`alt` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar` (`id`));");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_price_history` (
`id` INTEGER PRIMARY KEY NOT NULL,
`tovar_id` INTEGER,
`status` INTEGER,
`docs_id` INTEGER,
`t` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`),
FOREIGN KEY (`docs_id`) REFERENCES `docs`(`id`)
);");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_history` (
`id` INTEGER PRIMARY KEY NOT NULL,
`session_id` TEXT,
`tovar_id` INTEGER,
`t` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`)
);");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_har_sp` ( `id` INTEGER PRIMARY KEY NOT NULL, `txt` TEXT );");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_har` (
`id` INTEGER PRIMARY KEY NOT NULL,
`tovar_har_sp_id` INTEGER,
`tovar_id` INTEGER,
`txt` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar` (`id`),
FOREIGN KEY (`tovar_har_sp_id`) REFERENCES `tovar_har_sp` (`id`) );");
\DB::set("CREATE TABLE IF NOT EXISTS 'cart' (
`id` INTEGER PRIMARY KEY NOT NULL,
`tovar_id` INTEGER,
`user_id` TEXT,
`kolvo` INTEGER,
`t` INTEGER,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`))");
\DB::set("CREATE TABLE IF NOT EXISTS 'tovar_barcode' (
`id` INTEGER PRIMARY KEY NOT NULL,
`barcode` INTEGER,
`tovar_id` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`))");
\DB::set("CREATE TABLE IF NOT EXISTS 'tovar_brand' (
`id` INTEGER PRIMARY KEY NOT NULL,
`brand` INTEGER,
`tovar_id` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`))");
\DB::alterTable("ALTER TABLE `tovar_price_history` ADD `cena` INTEGER");
\DB::alterTable("ALTER TABLE `tovar_price_history` ADD `docs_id` INTEGER");
\DB::alterTable("ALTER TABLE `docs` ADD `status` INTEGER");
\DB::alterTable("ALTER TABLE `docs` ADD `comment` TEXT");
\DB::alterTable("ALTER TABLE `meta` ADD `keywords` TEXT");
\DB::alterTable("ALTER TABLE `meta` ADD `description` TEXT");
\DB::alterTable("ALTER TABLE `tovar_img` ADD `alt` TEXT");
\DB::alterTable("ALTER TABLE `tovar_img` ADD `title` TEXT");
\DB::alterTable("ALTER TABLE `tovar_category_img` ADD `alt` TEXT");
\DB::alterTable("ALTER TABLE `tovar_category_img` ADD `title` TEXT");
\DB::alterTable("ALTER TABLE `tovar_category` ADD `keywords` TEXT");
\DB::alterTable("ALTER TABLE `tovar_category` ADD `description` TEXT");
\DB::alterTable("ALTER TABLE `site_speed` ADD `user_id` TEXT");
// \DB::alterTable("ALTER TABLE `tovar_brand` ADD `description` TEXT");
?>