Hi,
Quick question:
My old database has the old-style FOREIGN KEY syntax:
CREATE CONSTRAINT TRIGGER "<unnamed>"
AFTER INSERT OR UPDATE ON assettype
FROM assettype
NOT DEFERRABLE INITIALLY IMMEDIATE
FOR EACH ROW
EXECUTE PROCEDURE "RI_FKey_check_ins"('<unnamed>', 'assettype', 'assettype', 'UNSPECIFIED', 'pid', 'id');
CREATE CONSTRAINT TRIGGER "<unnamed>"
AFTER DELETE ON assettype
FROM assettype
NOT DEFERRABLE INITIALLY IMMEDIATE
FOR EACH ROW
EXECUTE PROCEDURE "RI_FKey_cascade_del"('<unnamed>', 'assettype', 'assettype', 'UNSPECIFIED', 'pid', 'id');
CREATE CONSTRAINT TRIGGER "<unnamed>"
AFTER UPDATE ON assettype
FROM assettype
NOT DEFERRABLE INITIALLY IMMEDIATE
FOR EACH ROW
EXECUTE PROCEDURE "RI_FKey_cascade_upd"('<unnamed>', 'assettype', 'assettype', 'UNSPECIFIED', 'pid', 'id');
I was wondering if I need to worry about the RI_FKey_check_ins statement.
Will the following take care of all three statements?
ALTER TABLE ONLY assettype
ADD CONSTRAINT at_fk_1 FOREIGN KEY (pid) REFERENCES assettype(id)
ON UPDATE CASCADE ON DELETE CASCADE;
Are there any other gottcha's when doing this type of migration?
(I need to use the FKEY syntax, so a schema visualizer will show the
foreign key relationships).
thanks a ton,
mike