-- CreateTable
CREATE TABLE "platform_knowledge"."sp_folder_index" (
    "id" UUID NOT NULL,
    "sp_item_id" VARCHAR(255) NOT NULL,
    "sp_drive_id" VARCHAR(255) NOT NULL,
    "sp_site_id" VARCHAR(255) NOT NULL,
    "title" VARCHAR(500) NOT NULL,
    "folder_path" VARCHAR(1000) NOT NULL,
    "web_url" TEXT NOT NULL,
    "created_by" VARCHAR(255),
    "last_modified_by" VARCHAR(255),
    "sp_created_at" TIMESTAMPTZ(3),
    "sp_modified_at" TIMESTAMPTZ(3),
    "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMPTZ(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "sp_folder_index_sp_item_id_sp_drive_id_key" ON "platform_knowledge"."sp_folder_index"("sp_item_id", "sp_drive_id");

-- CreateIndex
CREATE INDEX "sp_folder_index_sp_site_id_idx" ON "platform_knowledge"."sp_folder_index"("sp_site_id");

-- CreateIndex
CREATE INDEX "sp_folder_index_sp_modified_at_idx" ON "platform_knowledge"."sp_folder_index"("sp_modified_at");

-- CreateIndex
CREATE INDEX "sp_folder_index_title_idx" ON "platform_knowledge"."sp_folder_index"("title");

-- CreateIndex
CREATE INDEX "sp_folder_index_folder_path_idx" ON "platform_knowledge"."sp_folder_index"("folder_path");
