I just happened to come across

        $ cat schema/spacewalk/rhnsat/tables/rhnKickstartScript.sql 
        create sequence rhn_ksscript_id_seq;

        create table
        rhnKickstartScript
        (
                id                      number
        [...]
        )
        [...]

        create or replace trigger
        rhn_ksscript_mod_trig
        before insert or update on rhnKickstartSession
        for each row
        begin
                :new.modified := sysdate;
        end rhn_ksscript_mod_trig;
        /
        show errors

plus

        $ grep 'before insert or update on rhnKickstartSession$' 
schema/spacewalk/rhnsat/tables/*
        schema/spacewalk/rhnsat/tables/rhnKickstartScript.sql:before insert or 
update on rhnKickstartSession
        schema/spacewalk/rhnsat/tables/rhnKickstartSession_triggers.sql:before 
insert or update on rhnKickstartSession

I wonder how many inconsistencies there might be in the schema
definitions. I can certainly fix the above as one off issue, but
maybe we could introduce some stricter rules concerning schema
definitions. For example, some of the tables have that

        for each row
        begin
                :new.modified := sysdate;
        end;

trigger in a separate tablename_triggers.sql file, some have it
in the tablename.sql file directly. Do we want to standardize on
something? Plus, maybe, during the spacewalk-schema build time we
could run some parser check to ensure that the definitions match
the rules, to avoid the problem like above in the future?

-- 
Jan Pazdziora
Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to