/*
  Warnings:

  - You are about to drop the column `tfType` on the `top_up_request` table. All the data in the column will be lost.
  - You are about to drop the `share_permission_request` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropForeignKey
ALTER TABLE "share_permission_request" DROP CONSTRAINT "share_permission_request_userId_fkey";

-- DropForeignKey
ALTER TABLE "share_permition_request_accounts" DROP CONSTRAINT "share_permition_request_accounts_requestId_fkey";

-- AlterTable
ALTER TABLE "account_request" ALTER COLUMN "platform" DROP DEFAULT;

-- AlterTable
ALTER TABLE "rename_request" ALTER COLUMN "platform" DROP DEFAULT;

-- AlterTable
ALTER TABLE "top_up_request" DROP COLUMN "tfType",
ALTER COLUMN "platform" DROP DEFAULT;

-- DropTable
DROP TABLE "share_permission_request";

-- CreateTable
CREATE TABLE "share_permition_request" (
    "id" SERIAL NOT NULL,
    "createDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updateDate" TIMESTAMP(3) NOT NULL,
    "note" TEXT,
    "status" "RequestStatus" NOT NULL DEFAULT 'NEW',
    "archived" BOOLEAN NOT NULL DEFAULT false,
    "requestType" "RequestType" NOT NULL DEFAULT 'SHARE_REQUEST',
    "platform" "TrafficSource",
    "userId" INTEGER NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "share_permition_request_id_key" ON "share_permition_request"("id");

-- AddForeignKey
ALTER TABLE "share_permition_request" ADD CONSTRAINT "share_permition_request_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "share_permition_request_accounts" ADD CONSTRAINT "share_permition_request_accounts_requestId_fkey" FOREIGN KEY ("requestId") REFERENCES "share_permition_request"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
