-- CreateTable
CREATE TABLE "component_set" (
    "web_path" VARCHAR(128) NOT NULL,
    "display_name" VARCHAR(128) NOT NULL,
    "description" VARCHAR,
    "env_vars" JSONB,
    "headers" JSONB,

    CONSTRAINT "component_set_pkey" PRIMARY KEY ("web_path")
);

-- CreateTable
CREATE TABLE "component_set_component_version" (
    "component_set_web_path" VARCHAR(128) NOT NULL,
    "component_name" VARCHAR(128) NOT NULL,
    "component_version" VARCHAR(128) NOT NULL,

    CONSTRAINT "component_set_component_version_pkey" PRIMARY KEY ("component_set_web_path", "component_name", "component_version")
);

-- AddForeignKey
ALTER TABLE "component_set_component_version" ADD CONSTRAINT "component_set_web_path_fkey" FOREIGN KEY ("component_set_web_path") REFERENCES "component_set"("web_path") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "component_set_component_version" ADD CONSTRAINT "component_version_componet_name_version_fkey" FOREIGN KEY ("component_name", "component_version") REFERENCES "component_version"("component_name", "version") ON DELETE CASCADE ON UPDATE CASCADE;
