Main Tables Views Materialized Views Indexes Constraints Triggers Procedures Functions Packages Sequences Java Sources Sanity Check Index DDL scrips
Description Columns Primary key Check Constraints Foreign keys Unique Keys Options Indexes Referenced by Triggers Partitions

RHNUSERGROUPMEMBERS

DDL script

Columns

NameTypeNullableDefault valueComment
USER_IDNUMBER(38)N  
USER_GROUP_IDNUMBER(38)N  
CREATEDDATEN(sysdate)  
MODIFIEDDATEN(sysdate)  

Foreign Keys:

Constraint NameColumnsReferenced tableReferenced ConstraintOn Delete Rule
RHN_UGMEMBERS_UGID_FKUSER_GROUP_ID RHNUSERGROUP RHN_USER_GROUP_PK NO ACTION
RHN_UGMEMBERS_UID_FKUSER_ID WEB_CONTACT WEB_CONTACT_PK CASCADE

Options:

OptionSettings
TablespaceDATA_TBS
Index OrganizedNo
Generated by OracleNo
ClusteredNo
NestedNo
TemporaryNo

Indexes:

Index NameTypeUnuquenessColumnsDDL script
RHN_UGMEMBERS_UGID_UID_IDXNORMALNONUNIQUEUSER_GROUP_ID , USER_ID DDL script
RHN_UGMEMBERS_UID_UGID_UQNORMALUNIQUEUSER_ID , USER_GROUP_ID DDL script

Triggers

RHN_UGM_APPLICANT_FIX

Legend: comment string keyword reserved word operator
CREATE TRIGGER 
rhn_ugm_applicant_fix
after delete on rhnUserGroupMembers
for each row

REFERENCING NEW AS NEW OLD AS OLD
declare
    	group_type_val    NUMBER;
    	group_label_val   rhnUserGroupType.label%TYPE;
begin
    	SELECT group_type INTO group_type_val
	  FROM rhnUserGroup
	 WHERE id = :old.user_group_id;
	IF group_type_val IS NOT NULL
	THEN
	    SELECT label INTO group_label_val
	      FROM rhnUserGroupType
	     WHERE id = group_type_val;
	    IF group_label_val = 'org_applicant'
	    THEN
	    	UPDATE web_contact SET password = old_password WHERE id = :old.user_id;
	    END IF;
	END IF;
end;

RHN_UG_MEMBER_DEL_TRIG

Legend: comment string keyword reserved word operator
CREATE TRIGGER 
rhn_ug_member_del_trig
before delete on rhnUserGroupMembers
for each row

REFERENCING NEW AS NEW OLD AS OLD
begin
        update rhnUserGroup
        set current_members = current_members - 1
        where id = :old.user_group_id;
end;

RHN_UG_MEMBER_MOD_TRIG

Legend: comment string keyword reserved word operator
CREATE TRIGGER 
rhn_ug_member_mod_trig
before insert or update on rhnUserGroupMembers
for each row

REFERENCING NEW AS NEW OLD AS OLD
declare
        ug              rhnUserGroup%ROWTYPE;
begin
        :new.modified := sysdate;
        if inserting then
                select
                        * into ug
                from
                        rhnUserGroup
                where
                        id = :new.user_group_id;
                if ug.max_members is not null and
                ug.current_members+1 gt; ug.max_members then
                        rhn_exception.raise_exception('usergroup_max_members');
                end if;
                update rhnUserGroup
                set current_members = current_members + 1
                where id = :new.user_group_id;
        end if;
end;

RHN_USER_GROUP_ORG_MAPPING

Legend: comment string keyword reserved word operator
CREATE TRIGGER 
rhn_user_group_org_mapping
BEFORE INSERT OR UPDATE ON rhnUserGroupMembers
FOR EACH ROW

REFERENCING NEW AS NEW OLD AS OLD
DECLARE
        same_org        NUMBER;
BEGIN
        same_org := 0;
        SELECT 1 INTO same_org
          FROM web_contact U, rhnUserGroup UG
         WHERE UG.org_id = U.org_id
           AND U.id = :new.user_id
           AND UG.id = :new.user_group_id;
        IF same_org = 0 THEN
          rhn_exception.raise_exception('ugm_different_orgs');
        END IF;
EXCEPTION
        WHEN NO_DATA_FOUND THEN
          rhn_exception.raise_exception('ugm_different_orgs');
END;