/*
  Warnings:

  - You are about to drop the column `businessDirection` on the `account` table. All the data in the column will be lost.

*/
-- CreateEnum
CREATE TYPE "AccountPayoutStatus" AS ENUM ('DONE', 'NONE');

-- AlterTable
ALTER TABLE "account" DROP COLUMN "businessDirection",
ADD COLUMN     "externalAccountFee" DOUBLE PRECISION,
ADD COLUMN     "internalAccountFee" DOUBLE PRECISION;

-- AlterTable
ALTER TABLE "team" ADD COLUMN     "businessDirectionId" INTEGER,
ADD COLUMN     "parentTeamId" INTEGER;

-- DropEnum
DROP TYPE "BusinessDirection";

-- CreateTable
CREATE TABLE "business_direction" (
    "id" SERIAL NOT NULL,
    "createAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updateAt" TIMESTAMP(3) NOT NULL,
    "name" TEXT NOT NULL,

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

-- AddForeignKey
ALTER TABLE "team" ADD CONSTRAINT "team_businessDirectionId_fkey" FOREIGN KEY ("businessDirectionId") REFERENCES "business_direction"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "team" ADD CONSTRAINT "team_parentTeamId_fkey" FOREIGN KEY ("parentTeamId") REFERENCES "team"("id") ON DELETE SET NULL ON UPDATE CASCADE;
