gustafn
committed
on 27 Aug 13
- get rid of empty_string_p
openacs-4/.../postgresql/site-nodes-create.sql (+10 -1)
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         -- Is it legal to create a child node?
56 56         directory_p     boolean not null,
57 57         -- Should urls that are logical children of this node be
58 58         -- mapped to this node?
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 -- Avoid potential loops on site_node parent_ids. A parent_id must be
  66 -- different from the node_id.
  67 -- Note that this constraint is not guaranteed to avoid all loops;
  68 -- it is still possible to create indirect recursive
  69 -- loops but excludes some real-world problems.
  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 -- procedure site_node__new/8
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,       -- default null
77 86    new__parent_id integer,     -- default null
78 87    new__name varchar,
79 88    new__object_id integer,     -- default null
80 89    new__directory_p boolean,
81 90    new__pattern_p boolean,     -- default 'f'
82 91    new__creation_user integer, -- default null
83 92    new__creation_ip varchar    -- default null