/* Warnings: - You are about to drop the `StatusHistory` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "StatusHistory" DROP CONSTRAINT "StatusHistory_hospital_id_fkey"; -- DropForeignKey ALTER TABLE "StatusHistory" DROP CONSTRAINT "StatusHistory_user_id_fkey"; -- DropTable DROP TABLE "StatusHistory"; -- CreateTable CREATE TABLE "status_histories" ( "id" TEXT NOT NULL, "hospital_id" TEXT NOT NULL, "user_id" TEXT NOT NULL, "old_status" "ProgressStatus" NOT NULL, "new_status" "ProgressStatus" NOT NULL, "notes" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "deletedAt" TIMESTAMP(3), CONSTRAINT "status_histories_pkey" PRIMARY KEY ("id") ); -- AddForeignKey ALTER TABLE "status_histories" ADD CONSTRAINT "status_histories_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospitals"("id") ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "status_histories" ADD CONSTRAINT "status_histories_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;