Line # Revision Author
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 );
15 create index documents_sections on documents using gist ( "sections" "gist__int_ops" );
16 create index documents_dtime on documents (dtime);
17 create table documents_extra
18 (
19 id integer not null,
20 data text,
21 constraint delete_document foreign key (id) references documents (id) on delete cascade
22 );
23 create index documents_extra_id on documents_extra (id);
24
25
26 create table sections
27 (
28 id integer not null primary key default nextval('public.documents_id_seq'::text),
29 pid integer,
30 class text not null,
31 ctime timestamp not null default now(),
32 mtime timestamp not null default now(),
33 status smallint not null default 0,
34 sorder integer default 1,
35 name text,
36 alias text
37 );
38 create index sections_parent on sections (pid);
39 create index sections_alias_pid on sections (alias, pid);
40 insert into sections (id, status, sorder, class, name) values (1, 1, 1, 'Contenido::Section', 'Корневая секция');
41 create table sections_extra
42 (
43 id integer not null,
44 data text,
45 constraint delete_section foreign key (id) references sections (id) on delete cascade
46 );
47 create index sections_extra_id on sections_extra (id);
48
49
50
51 create table links
52 (
53 id integer not null primary key default nextval('public.documents_id_seq'::text),
54 class text not null,
55 ctime timestamp not null default now(),
56 mtime timestamp not null default now(),
57 status smallint not null default 1,
58 source_id integer not null,
59 source_class text not null,
60 dest_id integer not null,
61 dest_class text not null
62 );
63 create index links_source on links (source_id);
64 create index links_dest on links (dest_id);
65 create table links_extra
66 (
67 id integer not null,
68 data text,
69 constraint delete_link foreign key (id) references links (id) on delete cascade
70 );
71 create index links_extra_id on links_extra (id);
72
73
74
75 create table users
76 (
77 id integer not null primary key default nextval('public.documents_id_seq'::text),
78 login text not null,
79 class text not null,
80 ctime timestamp not null default now(),
81 mtime timestamp not null default now(),
82 status smallint not null default 1,
83 name text,
84 passwd text not null,
85 groups integer[]
86 );
87 create unique index users_login on users(login);
88 create table users_extra
89 (
90 id integer not null,
91 data text,
92 constraint delete_user foreign key (id) references users (id) on delete cascade
93 );
94 create index users_extra_id on users_extra (id);
95
96 create table options (
97 id integer not null primary key default nextval('public.documents_id_seq'::text),
98 pid integer,
99 name text,
100 value text,
101 "type" text not null
102 );
103
104 insert into options values (1, NULL, 's_alias', NULL, 'HASH');
105 insert into options values (2, NULL, 'widths', NULL, 'HASH');
106 insert into options values (3, NULL, 'redirects', NULL, 'HASH');
107 insert into options values (4, NULL, 'users', NULL, 'HASH');
108 insert into options values (5, 4, 'Contenido::User::DefaultUser', NULL, 'HASH');
109 insert into options values (6, NULL, 'links', NULL, 'HASH');
110 insert into options values (7, 6, 'Contenido::Link::DefaultLink', NULL, 'HASH');
111 insert into options values (8, NULL, 'sections', NULL, 'HASH');
112 insert into options values (9, 8, 'Contenido::Section::DefaultSection', NULL, 'HASH');
113 insert into options values (10, NULL, 'colors', NULL, 'HASH');
114 insert into options values (11, NULL, 'tabs', NULL, 'HASH');
115 insert into options values (12, 11, 'admin', NULL, 'HASH');
116 insert into options values (13, 12, 'id', 'admin', 'SCALAR');
117 insert into options values (14, 12, 'sections', NULL, 'ARRAY');
118 insert into options values (15, 14, '0', 'Contenido::Section::DefaultSection', 'SCALAR');
119 insert into options values (16, 12, 'lefts', NULL, 'ARRAY');
120 insert into options values (17, 16, '0', 'structure', 'SCALAR');
121 insert into options values (18, 16, '1', 'project', 'SCALAR');
122 insert into options values (19, 12, 'name', 'Администрирование', 'SCALAR');
123 insert into options values (20, 11, 'rubricator', NULL, 'HASH');
124 insert into options values (21, 20, 'id', 'rubricator', 'SCALAR');
125 insert into options values (22, 20, 'sections', NULL, 'ARRAY');
126 insert into options values (23, 22, '0', 'Contenido::Section::DefaultSection', 'SCALAR');
127 insert into options values (24, 20, 'lefts', NULL, 'ARRAY');
128 insert into options values (25, 24, '0', 'finder', 'SCALAR');
129 insert into options values (26, 20, 'name', 'Тематический рубрикатор', 'SCALAR');
130 insert into options values (27, NULL, 'documents', NULL, 'HASH');
131 insert into options values (28, 27, 'Contenido::Document::DefaultDocument', NULL, 'HASH');