core/set/install/install_sqlite3.php

165 lines
4.0 KiB
PHP
Raw Normal View History

2022-12-17 18:15:09 +05:00
<?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
)");
2022-12-24 21:12:23 +05:00
\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`));");
2022-12-17 18:15:09 +05:00
\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,
2022-12-24 21:12:23 +05:00
FOREIGN KEY (`city_id`) REFERENCES `city` (`city`),
2022-12-17 18:15:09 +05:00
FOREIGN KEY (`org_id`) REFERENCES `org` (`city`));");
2022-12-17 19:10:16 +05:00
\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`)
);");
2022-12-24 21:12:23 +05:00
\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`))");
2022-12-17 19:10:16 +05:00
\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");
2022-12-24 21:12:23 +05:00
\DB::alterTable("ALTER TABLE `docs` ADD `comment` TEXT");
2022-12-17 18:15:09 +05:00
?>