migration.sql 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Warnings:
  3. - You are about to drop the column `simrs_type` on the `hospitals` table. All the data in the column will be lost.
  4. - You are about to drop the `vendor_histories` table. If the table is not empty, all the data it contains will be lost.
  5. */
  6. -- DropForeignKey
  7. ALTER TABLE "vendor_histories" DROP CONSTRAINT "vendor_histories_hospital_id_fkey";
  8. -- DropForeignKey
  9. ALTER TABLE "vendor_histories" DROP CONSTRAINT "vendor_histories_vendor_id_fkey";
  10. -- AlterTable
  11. ALTER TABLE "hospitals" DROP COLUMN "simrs_type";
  12. -- DropTable
  13. DROP TABLE "vendor_histories";
  14. -- CreateTable
  15. CREATE TABLE "vendor_experiences" (
  16. "id" TEXT NOT NULL,
  17. "hospital_id" TEXT NOT NULL,
  18. "vendor_id" TEXT,
  19. "status" TEXT,
  20. "contract_start_date" TIMESTAMP(3),
  21. "contract_expired_date" TIMESTAMP(3),
  22. "contract_value_min" BIGINT,
  23. "contract_value_max" BIGINT,
  24. "positive_notes" TEXT,
  25. "negative_notes" TEXT,
  26. "simrs_type" TEXT NOT NULL,
  27. "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
  28. "updatedAt" TIMESTAMP(3) NOT NULL,
  29. "deletedAt" TIMESTAMP(3),
  30. CONSTRAINT "vendor_experiences_pkey" PRIMARY KEY ("id")
  31. );
  32. -- AddForeignKey
  33. ALTER TABLE "vendor_experiences" ADD CONSTRAINT "vendor_experiences_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospitals"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
  34. -- AddForeignKey
  35. ALTER TABLE "vendor_experiences" ADD CONSTRAINT "vendor_experiences_vendor_id_fkey" FOREIGN KEY ("vendor_id") REFERENCES "vendors"("id") ON DELETE SET NULL ON UPDATE CASCADE;