-- Script para crear el campo id_headquarter_f
BEGIN;

-- CREATE FIELD "id_headquarter_f" -----------------------------
ALTER TABLE "public"."facturas" ADD COLUMN "id_headquarter_f" UUid;
-- -------------------------------------------------------------

COMMIT;


BEGIN;

-- CREATE LINK "lnk_headquarter_facturas" ----------------------
ALTER TABLE "public"."facturas"
	ADD CONSTRAINT "lnk_headquarter_facturas" FOREIGN KEY ( "id_headquarter_f" )
	REFERENCES "public"."headquarter" ( "id_headquarter" ) MATCH FULL
	ON DELETE RESTRICT
	ON UPDATE Cascade;
-- -------------------------------------------------------------

COMMIT;
