ACC SHELL
drop table if exists products;
create table products (
id int not null auto_increment primary key,
name_idx varchar(150) unique,
name varchar(50) unique,
descr text default null,
parent int default null,
is_cat tinyint default '0',
img_name varchar(150),
pdf_name varchar(150),
sw_name text,
prod_sort tinyint default '1',
par_width smallint default '0'
);
create table prod_parameters (
id int not null auto_increment primary key,
par_name varchar(50),
par_text text,
product int not null,
par_sort int default '1',
prod_name varchar(50),
key (product)
);
create table configs (
conf_name varchar(50) unique,
conf_value mediumtext,
conf_type varchar(10)
);
drop table if exists articles;
create table articles (
id int not null auto_increment primary key,
article_type tinyint default '1',
title varchar(150),
title_idx varchar(156),
icon varchar(150),
content text not null,
perex text not null,
published tinyint default '0' not null,
publish_from date default null,
publish_to date default null,
created_d datetime not null,
news tinyint default '1',
files text,
key title_idx (title_idx)
);
create table files (
id int not null auto_increment primary key,
file_name varchar(150) unique
file_size int,
content_type varchar(50),
dims varchar(10),
public smallint default '0',
key (content_type)
);
create table users (
id int not null auto_increment primary key,
logname varchar(50) NOT NULL default '',
pass varchar(50) NOT NULL default '!',
firm varchar(50),
real_name varchar(50) default '',
email varchar(50) NOT NULL default '',
address varchar(150),
phone varchar(15),
fax varchar(15),
interest smallint(6),
created_d datetime,
unique (logname),
unique (email)
);
CREATE TABLE `customers` (
`id` int(11) NOT NULL auto_increment,
`logname` varchar(50) NOT NULL default '',
`pass` varchar(50) NOT NULL default '!',
`firm` varchar(50) default NULL,
`real_name` varchar(50) default '',
`email` varchar(50) NOT NULL default '',
`address` varchar(150) default NULL,
`phone` varchar(15) default NULL,
`fax` varchar(15) default NULL,
`interest` smallint(6) default NULL,
`created_d` datetime default NULL,
`hash` varchar(50) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `logname` (`logname`),
UNIQUE KEY `email` (`email`)
)
create table search (
content text,
content_ascii text,
title varchar(255),
url varchar(255),
type int,
id int,
unique (id, type),
fulltext (content_ascii)
);
-- changelog
alter table files add public smallint default '0';
update files set public = 1 where content_type like 'image/%';
alter table files drop file_type;
update articles set article_type = 0;
-- 16.8.
create table search_words (
id int not null primary key auto_increment,
word varchar(20) unique,
cnt int
);
create table search_words_docs (
word_id int not null,
doc_id int not null,
unique (word_id, doc_id)
);
update articles set article_type = 0;
-- 17.8.
-- update par_width
-- 18.8.
alter table customers add send_news tinyint default '0';
ACC SHELL 2018