daveb
committed
on 28 Jul 03
file index.vuh was initially added on branch openacs-org.
MAIN:daveb:20030728015142
/postgresql/acs-relationships-create.sql (+6 -4)
361 361 ';
362 362
363 363
364 364 ----------------------------
365 365 -- Application Data Links --
366 366 ----------------------------
367 367
368 368 create sequence acs_data_links_seq start with 1;
369 369
370 370 create table acs_data_links (
371 371         rel_id          integer not null
372 372                         constraint acs_data_links_rel_id_pk primary key,
373 373         object_id_one   integer not null
374 374                         constraint acs_data_links_obj_one_fk
375 375                         references acs_objects (object_id)
376 376                         on delete cascade,
377 377         object_id_two   integer not null
378 378                         constraint acs_data_links_obj_two_fk
379 379                         references acs_objects (object_id)
380 380                         on delete cascade,
381           relation_tag    varchar(100),
382           constraint acs_data_links_un unique
383           (object_id_one, object_id_two, relation_tag)
  381         relation_tag    varchar(100)
384 382 );
385 383
386 384 create index acs_data_links_id_one_idx on acs_data_links (object_id_one);
387 385 create index acs_data_links_id_two_idx on acs_data_links (object_id_two);
388 386 create index acs_data_links_rel_tag_idx on acs_data_links (relation_tag);
389 387
  388 create unique index acs_data_links_un on acs_data_links (
  389   object_id_one, object_id_two, relation_tag
  390 );
  391
390 392 --------------
391 393 -- TRIGGERS --
392 394 --------------
393 395
394 396 -- added by oumi@arsdigita.com - Jan 11, 2001
395 397
396 398 create function acs_rels_in_tr () returns opaque as '
397 399 declare
398 400   dummy integer;
399 401   target_object_type_one acs_object_types.object_type%TYPE;
400 402   target_object_type_two acs_object_types.object_type%TYPE;
401 403   actual_object_type_one acs_object_types.object_type%TYPE;
402 404   actual_object_type_two acs_object_types.object_type%TYPE;
403 405 begin
404 406
405 407     -- DRB: The obvious rewrite to use Dan''s port of this to use tree_ancestor_keys kills
406 408     -- Postgres!!!  Argh!!!  This is fast, to, so there ...
407 409
408 410     -- Get all the object type info from the relationship.
409 411