/*
 * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
 *
 */

-- liquibase formatted sql


-- changeset apg:1754784691547-31
ALTER TABLE marriage_certificate
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_BRIDE_FATHER FOREIGN KEY (bride_father) REFERENCES person (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_BRIDE_RESIDENCE FOREIGN KEY (bride_residence_id) REFERENCES place (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_FIRST_WITNESS FOREIGN KEY (first_witness) REFERENCES person (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_GROOM_FATHER FOREIGN KEY (groom_father) REFERENCES person (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_GROOM_RESIDENCE FOREIGN KEY (groom_residence_id) REFERENCES place (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_ORGANISATION FOREIGN KEY (organisation_id) REFERENCES organisation (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_REGISTRATION_AUTHORITY FOREIGN KEY (registration_authority) REFERENCES organisation (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_SECOND_WITNESS FOREIGN KEY (second_witness) REFERENCES person (id),
    ADD CONSTRAINT FK_MARRIAGECERTIFICATE_ON_WHERE_MARRIED FOREIGN KEY (where_married_id) REFERENCES place (id);

