migration.sql 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Warnings:
  3. - You are about to drop the column `tag` on the `categories` table. All the data in the column will be lost.
  4. - You are about to drop the column `contract_expired_date` on the `vendor_experiences` table. All the data in the column will be lost.
  5. - You are about to drop the column `contract_start_date` on the `vendor_experiences` table. All the data in the column will be lost.
  6. - You are about to drop the column `contract_value_max` on the `vendor_experiences` table. All the data in the column will be lost.
  7. - You are about to drop the column `contract_value_min` on the `vendor_experiences` table. All the data in the column will be lost.
  8. - You are about to drop the column `negative_notes` on the `vendor_experiences` table. All the data in the column will be lost.
  9. - You are about to drop the column `positive_notes` on the `vendor_experiences` table. All the data in the column will be lost.
  10. - You are about to drop the column `simrs_type` on the `vendor_experiences` table. All the data in the column will be lost.
  11. - You are about to drop the column `status` on the `vendor_experiences` table. All the data in the column will be lost.
  12. - You are about to drop the `category_links` table. If the table is not empty, all the data it contains will be lost.
  13. - Added the required column `name` to the `categories` table without a default value. This is not possible if the table is not empty.
  14. - Added the required column `user_id` to the `vendor_experiences` table without a default value. This is not possible if the table is not empty.
  15. */
  16. -- DropForeignKey
  17. ALTER TABLE "category_links" DROP CONSTRAINT "category_links_category_id_fkey";
  18. -- AlterTable
  19. ALTER TABLE "categories" DROP COLUMN "tag",
  20. ADD COLUMN "name" TEXT NOT NULL;
  21. -- AlterTable
  22. ALTER TABLE "vendor_experiences" DROP COLUMN "contract_expired_date",
  23. DROP COLUMN "contract_start_date",
  24. DROP COLUMN "contract_value_max",
  25. DROP COLUMN "contract_value_min",
  26. DROP COLUMN "negative_notes",
  27. DROP COLUMN "positive_notes",
  28. DROP COLUMN "simrs_type",
  29. DROP COLUMN "status",
  30. ADD COLUMN "category_id" TEXT,
  31. ADD COLUMN "userKeycloakId" TEXT,
  32. ADD COLUMN "user_id" TEXT NOT NULL;
  33. -- DropTable
  34. DROP TABLE "category_links";
  35. -- AddForeignKey
  36. ALTER TABLE "vendor_experiences" ADD CONSTRAINT "vendor_experiences_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
  37. -- AddForeignKey
  38. ALTER TABLE "vendor_experiences" ADD CONSTRAINT "vendor_experiences_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
  39. -- AddForeignKey
  40. ALTER TABLE "vendor_experiences" ADD CONSTRAINT "vendor_experiences_userKeycloakId_fkey" FOREIGN KEY ("userKeycloakId") REFERENCES "keycloak_users"("id") ON DELETE SET NULL ON UPDATE CASCADE;