-- CreateTable
CREATE TABLE "idea_products" (
    "id" TEXT NOT NULL,
    "idea_id" TEXT NOT NULL,
    "product_id" TEXT NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "idea_products_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "idea_products_product_id_idx" ON "idea_products"("product_id");

-- CreateIndex
CREATE UNIQUE INDEX "idea_products_idea_id_product_id_key" ON "idea_products"("idea_id", "product_id");

-- AddForeignKey
ALTER TABLE "idea_products" ADD CONSTRAINT "idea_products_idea_id_fkey" FOREIGN KEY ("idea_id") REFERENCES "ideas"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "idea_products" ADD CONSTRAINT "idea_products_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "products"("id") ON DELETE CASCADE ON UPDATE CASCADE;
