145 lines
3.5 KiB
PHP
145 lines
3.5 KiB
PHP
<?php
|
|
|
|
|
|
\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 `settings` (
|
|
`id` INTEGER PRIMARY KEY NOT NULL,
|
|
`mod` TEXT,
|
|
`json` TEXT,
|
|
`resurs` 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,
|
|
`keywords` 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_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,
|
|
`keywords` TEXT,
|
|
`alias` TEXT,
|
|
`description` 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 `users` (`city`),
|
|
FOREIGN KEY (`org_id`) REFERENCES `org` (`city`));");
|
|
|
|
\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::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");
|
|
?>
|