/*
  Warnings:

  - You are about to drop the column `teamFinanceProfileId` on the `finance_profile` table. All the data in the column will be lost.
  - You are about to drop the column `userFinanceProfileId` on the `finance_profile` table. All the data in the column will be lost.
  - A unique constraint covering the columns `[financeProfileId]` on the table `team_finance_profile` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[financeProfileId]` on the table `user_finance_profile` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `financeProfileId` to the `team_finance_profile` table without a default value. This is not possible if the table is not empty.
  - Made the column `teamId` on table `team_finance_profile` required. This step will fail if there are existing NULL values in that column.
  - Added the required column `financeProfileId` to the `user_finance_profile` table without a default value. This is not possible if the table is not empty.
  - Made the column `userId` on table `user_finance_profile` required. This step will fail if there are existing NULL values in that column.

*/
-- DropForeignKey
ALTER TABLE "finance_profile" DROP CONSTRAINT "finance_profile_teamFinanceProfileId_fkey";

-- DropForeignKey
ALTER TABLE "finance_profile" DROP CONSTRAINT "finance_profile_userFinanceProfileId_fkey";

-- DropForeignKey
ALTER TABLE "team_finance_profile" DROP CONSTRAINT "team_finance_profile_teamId_fkey";

-- DropIndex
DROP INDEX "finance_profile_teamFinanceProfileId_key";

-- DropIndex
DROP INDEX "finance_profile_userFinanceProfileId_key";

-- AlterTable
ALTER TABLE "finance_profile" DROP COLUMN "teamFinanceProfileId",
DROP COLUMN "userFinanceProfileId";

-- AlterTable
ALTER TABLE "team_finance_profile" ADD COLUMN     "financeProfileId" INTEGER NOT NULL,
ALTER COLUMN "teamId" SET NOT NULL;

-- AlterTable
ALTER TABLE "user_finance_profile" ADD COLUMN     "financeProfileId" INTEGER NOT NULL,
ALTER COLUMN "userId" SET NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "team_finance_profile_financeProfileId_key" ON "team_finance_profile"("financeProfileId");

-- CreateIndex
CREATE UNIQUE INDEX "user_finance_profile_financeProfileId_key" ON "user_finance_profile"("financeProfileId");

-- AddForeignKey
ALTER TABLE "user_finance_profile" ADD CONSTRAINT "user_finance_profile_financeProfileId_fkey" FOREIGN KEY ("financeProfileId") REFERENCES "finance_profile"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "team_finance_profile" ADD CONSTRAINT "team_finance_profile_financeProfileId_fkey" FOREIGN KEY ("financeProfileId") REFERENCES "finance_profile"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "team_finance_profile" ADD CONSTRAINT "team_finance_profile_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "team"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
