-- CreateTable
CREATE TABLE "tbl_follower" (
    "id" BIGSERIAL NOT NULL,
    "user_id" BIGINT NOT NULL,
    "brand_id" BIGINT NOT NULL,
    "is_active" BOOLEAN DEFAULT true,
    "inserted_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3),

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

-- CreateIndex
CREATE INDEX "tbl_follower_user_id_idx" ON "tbl_follower"("user_id");

-- CreateIndex
CREATE INDEX "tbl_follower_brand_id_idx" ON "tbl_follower"("brand_id");

-- CreateIndex
CREATE UNIQUE INDEX "tbl_follower_user_id_brand_id_key" ON "tbl_follower"("user_id", "brand_id");

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

-- AddForeignKey
ALTER TABLE "tbl_follower" ADD CONSTRAINT "tbl_follower_brand_id_fkey" FOREIGN KEY ("brand_id") REFERENCES "tbl_user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
