--------------------------------------------
CREATE SEQUENCE public."LocationPackageMap_LocationPackageMapId_seq";
CREATE TABLE public."LocationPackageMap"
(
    "LocationPackageMapId" integer NOT NULL DEFAULT nextval('"LocationPackageMap_LocationPackageMapId_seq"'::regclass),
    "PackageId" integer NOT NULL,
	"LocationId" integer NOT NULL,
    
    CONSTRAINT "LocationPackageMap_pkey" PRIMARY KEY ("LocationPackageMapId"),
    CONSTRAINT "FK_LocationPackageMap_PackageId" FOREIGN KEY ("PackageId")
        REFERENCES public."Package" ("PackageId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE,
    CONSTRAINT "FK_LocationPackageMap_LocationId" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE
);
-----------------------------------

CREATE SEQUENCE public."LocationMealTypesMap_LocationMealTypesMapId_seq";
CREATE TABLE public."LocationMealTypesMap"
(
    "LocationMealTypesMapId" integer NOT NULL DEFAULT nextval('"LocationMealTypesMap_LocationMealTypesMapId_seq"'::regclass),
    "MealTypeId" integer NOT NULL,
	"LocationId" integer NOT NULL,
    
    CONSTRAINT "LocationMealTypesMap_pkey" PRIMARY KEY ("LocationMealTypesMapId"),
    CONSTRAINT "FK_LocationMealTypesMap_MealTypeId" FOREIGN KEY ("MealTypeId")
        REFERENCES public."MealTypes" ("MealTypeId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE,
    CONSTRAINT "FK_LocationMealTypesMap_LocationId" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE
);
--------------------------------------------
CREATE SEQUENCE public."LocationFloorMap_LocationFloorMapId_seq";
CREATE TABLE public."LocationFloorMap"
(
    "LocationFloorMapId" integer NOT NULL DEFAULT nextval('"LocationFloorMap_LocationFloorMapId_seq"'::regclass),
    "FloorId" integer NOT NULL,
	"LocationId" integer NOT NULL,
    
    CONSTRAINT "LocationFloorMap_pkey" PRIMARY KEY ("LocationFloorMapId"),
    CONSTRAINT "FK_LocationFloorMap_FloorId" FOREIGN KEY ("FloorId")
        REFERENCES public."Floor" ("FloorId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE,
    CONSTRAINT "FK_LocationFloorMap_LocationId" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE CASCADE
        ON DELETE CASCADE
);
------------------------------------------
ALTER TABLE "Specialization" ADD PRIMARY KEY ("SpecializationId");

CREATE TABLE public."LocationSpecializationMap"
(
    "LocationSpecializationMapId" bigserial,
    "SpecializationId" bigint NOT NULL references "Specialization"("SpecializationId"),
    "LocationId" bigint NOT NULL,
    CONSTRAINT "PK_LocationSpecializationMap_LocationSpecializationMapId" PRIMARY KEY ("LocationSpecializationMapId"),
    CONSTRAINT "FK_LocationSpecializationMap_LocationId" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION    
);



