 ON UPDATE NO ACTION
 NOT DEFERRABLE;
 
+ALTER TABLE public.system_relationshiprecordtorecordcrossref ADD CONSTRAINT system_relationshiprecord_system_relationshiprecordtorecordc18
+FOREIGN KEY (relationshiprecord_id2)
+REFERENCES public.system_relationshiprecord (id)
+ON DELETE NO ACTION
+ON UPDATE NO ACTION
+NOT DEFERRABLE;
+
+ALTER TABLE public.system_relationshiprecordtorecordcrossref ADD CONSTRAINT system_relationshiprecord_system_relationshiprecordtorecordc567
+FOREIGN KEY (relationshiprecord_id1)
+REFERENCES public.system_relationshiprecord (id)
+ON DELETE NO ACTION
+ON UPDATE NO ACTION
+NOT DEFERRABLE;
+
+ALTER TABLE public.system_relationshiprecordtobundlecrossref ADD CONSTRAINT system_relationshiprecord_system_relationshiprecordtobundlec161
+FOREIGN KEY (relationshiprecord_id)
+REFERENCES public.system_relationshiprecord (id)
+ON DELETE NO ACTION
+ON UPDATE NO ACTION
+NOT DEFERRABLE;
+
 ALTER TABLE public.events_systempropertystaticcrossref ADD CONSTRAINT property_record_events_systempropertystaticcrossref_fk
 FOREIGN KEY (propertyrecord_id)
 REFERENCES public.system_propertyrecord (id)

ON UPDATE NO ACTION
NOT DEFERRABLE;

ALTER TABLE public.events_eventpersoncrossref ADD CONSTRAINT events_eventpersoncrossref_thing_id_fkey
FOREIGN KEY (event_od)
REFERENCES public.events_event (id)


CREATE TABLE public.system_relationshiprecord (
                id INTEGER NOT NULL,
                date_created TIMESTAMP NOT NULL,
                last_updated TIMESTAMP NOT NULL,
                name VARCHAR NOT NULL,
                CONSTRAINT system_relationshiprecord_pk PRIMARY KEY (id)
);


CREATE TABLE public.system_relationshiprecordtorecordcrossref (
                id INTEGER NOT NULL,
                date_created TIMESTAMP NOT NULL,
                last_updated TIMESTAMP NOT NULL,
                relationshiprecord_id1 INTEGER NOT NULL,
                relationshiprecord_id2 INTEGER NOT NULL,
                CONSTRAINT system_relationshiprecordtorecordcrossref_pk PRIMARY KEY (id)
);


CREATE SEQUENCE public.system_propertyrecord_id_seq;

