core/api/modules/tovar_show/install_sqlite3.php

65 lines
1.7 KiB
PHP
Raw Normal View History

2022-12-17 18:15:09 +05:00
<?php
\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
);");
\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 `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_price_history` (
`id` INTEGER PRIMARY KEY NOT NULL,
`tovar_id` INTEGER,
`status` INTEGER,
`t` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar`(`id`));");
\DB::alterTable("ALTER TABLE `tovar_history` ADD `t` TEXT");
\DB::alterTable("ALTER TABLE `tovar_price_history` ADD `cena` INTEGER");
\DB::set("CREATE TABLE IF NOT EXISTS `tovar_img` (
`id` INTEGER PRIMARY KEY NOT NULL,
`filename` TEXT,
`tovar_id` INTEGER,
`md5` TEXT,
`tovar_id_1c` TEXT,
FOREIGN KEY (`tovar_id`) REFERENCES `tovar` (`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,
FOREIGN KEY (`tovar_category_id`) REFERENCES `tovar_category` (`id`))
");
?>