| |
44 |
44 |
node_id integer constraint site_nodes_node_id_fk |
| |
45 |
45 |
references acs_objects (object_id) |
| |
46 |
46 |
constraint site_nodes_node_id_pk |
| |
47 |
47 |
primary key, |
| |
48 |
48 |
parent_id integer constraint site_nodes_parent_id_fk |
| |
49 |
49 |
references site_nodes (node_id), |
| |
50 |
50 |
name text |
| |
51 |
51 |
constraint site_nodes_name_ck |
| |
52 |
52 |
check (name not like '%/%'), |
| |
53 |
53 |
constraint site_nodes_un |
| |
54 |
54 |
unique (parent_id, name), |
| |
55 |
55 |
|
| |
56 |
56 |
directory_p boolean not null, |
| |
57 |
57 |
|
| |
58 |
58 |
|
| |
59 |
59 |
pattern_p boolean default false not null, |
| |
60 |
60 |
object_id integer constraint site_nodes_object_id_fk |
| |
61 |
61 |
references acs_objects (object_id) |
| |
62 |
62 |
); |
| |
63 |
63 |
|
| |
|
64 |
|
| |
|
65 |
|
| |
|
66 |
|
| |
|
67 |
|
| |
|
68 |
|
| |
|
69 |
|
| |
|
70 |
|
| |
|
71 |
ALTER TABLE site_nodes ADD CONSTRAINT site_nodes_parent_id_ck CHECK (node_id <> parent_id); |
| |
|
72 |
|
| |
64 |
73 |
create index site_nodes_object_id_idx on site_nodes (object_id); |
| |
65 |
74 |
create index site_nodes_parent_object_node_id_idx on site_nodes(parent_id, object_id, node_id); |
| |
66 |
75 |
create index site_nodes_parent_id_idx on site_nodes(parent_id); |
| |
67 |
76 |
|
| |
68 |
77 |
|
| |
69 |
78 |
|
| |
70 |
79 |
|
| |
71 |
80 |
|
| |
72 |
81 |
select define_function_args('site_node__new','node_id;null,parent_id;null,name,object_id;null,directory_p,pattern_p;f,creation_user;null,creation_ip;null'); |
| |
73 |
82 |
|
| |
74 |
83 |
|
| |
75 |
84 |
CREATE OR REPLACE FUNCTION site_node__new( |
| |
76 |
85 |
new__node_id integer, |
| |
77 |
86 |
new__parent_id integer, |
| |
78 |
87 |
new__name varchar, |
| |
79 |
88 |
new__object_id integer, |
| |
80 |
89 |
new__directory_p boolean, |
| |
81 |
90 |
new__pattern_p boolean, |
| |
82 |
91 |
new__creation_user integer, |
| |
83 |
92 |
new__creation_ip varchar |