1 |
8 |
ahitrov@rambler.ru |
create sequence documents_id_seq; |
2 |
|
|
select setval('documents_id_seq', 101, true); |
3 |
|
|
|
4 |
|
|
create table documents |
5 |
|
|
( |
6 |
|
|
id integer not null primary key default nextval('public.documents_id_seq'::text), |
7 |
|
|
class text not null, |
8 |
|
|
ctime timestamp not null default now(), |
9 |
|
|
mtime timestamp not null default now(), |
10 |
|
|
dtime timestamp not null default now(), |
11 |
|
|
status smallint not null default 0, |
12 |
|
|
sections integer[], |
13 |
|
|
name text, |
14 |
|
|
data text |
15 |
|
|
); |
16 |
|
|
create index documents_sections on documents using gist ( "sections" "gist__int_ops" ); |
17 |
|
|
create index documents_dtime on documents (dtime); |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
create table sections |
21 |
|
|
( |
22 |
|
|
id integer not null primary key default nextval('public.documents_id_seq'::text), |
23 |
|
|
pid integer, |
24 |
|
|
class text not null, |
25 |
|
|
ctime timestamp not null default now(), |
26 |
|
|
mtime timestamp not null default now(), |
27 |
|
|
status smallint not null default 0, |
28 |
|
|
sorder integer default 1, |
29 |
|
|
name text, |
30 |
|
|
alias text, |
31 |
|
|
data text |
32 |
|
|
); |
33 |
|
|
create index sections_parent on sections (pid); |
34 |
|
|
create index sections_alias_pid on sections (alias, pid); |
35 |
|
|
insert into sections (id, status, sorder, class, name) values (1, 1, 1, 'Contenido::Section', 'Корневая секция'); |
36 |
|
|
|
37 |
|
|
|
38 |
|
|
create table links |
39 |
|
|
( |
40 |
|
|
id integer not null primary key default nextval('public.documents_id_seq'::text), |
41 |
|
|
class text not null, |
42 |
|
|
ctime timestamp not null default now(), |
43 |
|
|
mtime timestamp not null default now(), |
44 |
|
|
status smallint not null default 1, |
45 |
|
|
source_id integer not null, |
46 |
|
|
source_class text not null, |
47 |
|
|
dest_id integer not null, |
48 |
|
|
dest_class text not null, |
49 |
|
|
data text |
50 |
|
|
); |
51 |
|
|
create index links_source on links (source_id); |
52 |
|
|
create index links_dest on links (dest_id); |
53 |
|
|
|
54 |
|
|
create table users |
55 |
|
|
( |
56 |
|
|
id integer not null primary key default nextval('public.documents_id_seq'::text), |
57 |
|
|
login text not null, |
58 |
|
|
class text not null, |
59 |
|
|
ctime timestamp not null default now(), |
60 |
|
|
mtime timestamp not null default now(), |
61 |
|
|
status smallint not null default 1, |
62 |
|
|
name text, |
63 |
|
|
passwd text not null, |
64 |
|
|
groups integer[], |
65 |
|
|
data text |
66 |
|
|
); |
67 |
|
|
create unique index users_login on users(login); |
68 |
|
|
|
69 |
|
|
create table options ( |
70 |
|
|
id integer not null primary key default nextval('public.documents_id_seq'::text), |
71 |
|
|
pid integer, |
72 |
|
|
name text, |
73 |
|
|
value text, |
74 |
|
|
"type" text not null |
75 |
|
|
); |
76 |
|
|
|
77 |
|
|
insert into options values (1, NULL, 's_alias', NULL, 'HASH'); |
78 |
|
|
insert into options values (2, NULL, 'widths', NULL, 'HASH'); |
79 |
|
|
insert into options values (3, NULL, 'redirects', NULL, 'HASH'); |
80 |
|
|
insert into options values (4, NULL, 'users', NULL, 'HASH'); |
81 |
|
|
insert into options values (5, 4, 'Contenido::User::DefaultUser', NULL, 'HASH'); |
82 |
|
|
insert into options values (6, NULL, 'links', NULL, 'HASH'); |
83 |
|
|
insert into options values (7, 6, 'Contenido::Link::DefaultLink', NULL, 'HASH'); |
84 |
|
|
insert into options values (8, NULL, 'sections', NULL, 'HASH'); |
85 |
|
|
insert into options values (9, 8, 'Contenido::Section::DefaultSection', NULL, 'HASH'); |
86 |
|
|
insert into options values (10, NULL, 'colors', NULL, 'HASH'); |
87 |
|
|
insert into options values (11, NULL, 'tabs', NULL, 'HASH'); |
88 |
|
|
insert into options values (12, 11, 'admin', NULL, 'HASH'); |
89 |
|
|
insert into options values (13, 12, 'id', 'admin', 'SCALAR'); |
90 |
|
|
insert into options values (14, 12, 'sections', NULL, 'ARRAY'); |
91 |
|
|
insert into options values (15, 14, '0', 'Contenido::Section::DefaultSection', 'SCALAR'); |
92 |
|
|
insert into options values (16, 12, 'lefts', NULL, 'ARRAY'); |
93 |
|
|
insert into options values (17, 16, '0', 'structure', 'SCALAR'); |
94 |
|
|
insert into options values (18, 16, '1', 'project', 'SCALAR'); |
95 |
|
|
insert into options values (19, 12, 'name', 'Администрирование', 'SCALAR'); |
96 |
|
|
insert into options values (20, 11, 'rubricator', NULL, 'HASH'); |
97 |
|
|
insert into options values (21, 20, 'id', 'rubricator', 'SCALAR'); |
98 |
|
|
insert into options values (22, 20, 'sections', NULL, 'ARRAY'); |
99 |
|
|
insert into options values (23, 22, '0', 'Contenido::Section::DefaultSection', 'SCALAR'); |
100 |
|
|
insert into options values (24, 20, 'lefts', NULL, 'ARRAY'); |
101 |
|
|
insert into options values (25, 24, '0', 'finder', 'SCALAR'); |
102 |
|
|
insert into options values (26, 20, 'name', 'Тематический рубрикатор', 'SCALAR'); |
103 |
|
|
insert into options values (27, NULL, 'documents', NULL, 'HASH'); |
104 |
|
|
insert into options values (28, 27, 'Contenido::Document::DefaultDocument', NULL, 'HASH'); |