ALTER TABLE component_version
ADD CONSTRAINT component_version_component
FOREIGN KEY (component_name)
REFERENCES component(name)
ON DELETE CASCADE
ON UPDATE CASCADE;
- ON DELETE CASCADE: If a by component_version referenced value is delete from component, also delete all the corresponding records in this table
- ON UPDATE CASCADE: If a by component_version referenced value in component changes due to an UPDATE query, update the values in component_version too