-- CreateEnum
CREATE TYPE "favouritesType" AS ENUM ('product', 'brand');

-- CreateTable
CREATE TABLE "tbl_favourites" (
    "id" BIGSERIAL NOT NULL,
    "user_id" BIGINT NOT NULL,
    "product_id" BIGINT NOT NULL,
    "type" "favouritesType",
    "is_active" BOOLEAN DEFAULT true,
    "inserted_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3),

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

-- AddForeignKey
ALTER TABLE "tbl_favourites" ADD CONSTRAINT "tbl_favourites_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "tbl_user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "tbl_favourites" ADD CONSTRAINT "tbl_favourites_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "tbl_product"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
