create table registro_inventory(
	film_id integer,
	store_id integer,
	FOREIGN KEY (film_id)
      REFERENCES film (film_id),
	FOREIGN KEY (store_id)
      REFERENCES store (store_id)
);

CREATE OR REPLACE FUNCTION inventory_update()
  RETURNS TRIGGER 
  LANGUAGE PLPGSQL
  AS
$$
BEGIN
	
	 INSERT INTO registro_inventory(film_id,store_id)
	VALUES(OLD.film_id,OLD.store_id);
END;
$$

CREATE TRIGGER inventory_log
  AFTER UPDATE
  ON inventory
  FOR EACH ROW
  EXECUTE PROCEDURE inventory_update();