Ignore:
Timestamp:
10/30/12 09:45:25 (12 years ago)
Author:
nanardon
Message:

add managedAlsoBy attribute to group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/bin/la-sql-upgrade.in

    r1185 r1186  
    203203        ], 
    204204    }, 
     205    { 
     206        ver => 7, 
     207        sql => [ 
     208            q{ 
     209            CREATE OR REPLACE FUNCTION group_sort_fields() 
     210              RETURNS trigger AS 
     211              $BODY$BEGIN 
     212 
     213              IF (TG_OP='INSERT') then 
     214              IF (new.attr='managedBy' 
     215                  OR  new.attr='managedAlsoBy' 
     216                  OR  new.attr='member' 
     217                  OR  new.attr='memberUID') THEN 
     218              insert into group_attributes_users VALUES (new.*); 
     219              RETURN NULL; 
     220              END IF; 
     221 
     222              IF (new.attr='sutype') THEN 
     223              insert into group_attributes_sutypes VALUES (new.*); 
     224              RETURN NULL; 
     225              END IF; 
     226              end if; 
     227 
     228 
     229              IF (TG_OP = 'UPDATE') THEN 
     230              IF (new.attr='gidNumber') then 
     231              update "group" set gidnumber = new.value::integer where 
     232              "group".ikey = new.okey; 
     233              RETURN NULL; 
     234              END IF; 
     235              END IF; 
     236 
     237              IF (TG_OP = 'DELETE') THEN 
     238              IF (old.attr='exported') then 
     239              update "group" set exported = false where "group".ikey = old.okey; 
     240              return null; 
     241              end if; 
     242              else 
     243              IF (new.attr='exported') then 
     244              update "group" set exported = true where "group".ikey = new.okey; 
     245              RETURN NULL; 
     246              end if; 
     247              END IF; 
     248 
     249              if (TG_OP='DELETE') THEN 
     250              RETURN old; 
     251              else 
     252              RETURN new; 
     253              end if; 
     254              END;$BODY$ 
     255                LANGUAGE plpgsql VOLATILE 
     256                  COST 100; 
     257            }, 
     258        ], 
     259    }, 
     260 
    205261); 
    206262 
Note: See TracChangeset for help on using the changeset viewer.