/*
  Warnings:

  - You are about to drop the column `vendorId` on the `Product_info` table. All the data in the column will be lost.
  - You are about to drop the `Vendors` table. If the table is not empty, all the data it contains will be lost.
  - Added the required column `supplierId` to the `Product_info` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE `Product_info` DROP FOREIGN KEY `Product_info_vendorId_fkey`;

-- DropIndex
DROP INDEX `Product_info_vendorId_fkey` ON `Product_info`;

-- AlterTable
ALTER TABLE `Product_info` DROP COLUMN `vendorId`,
    ADD COLUMN `supplierId` INTEGER NOT NULL;

-- DropTable
DROP TABLE `Vendors`;

-- CreateTable
CREATE TABLE `Suppliers` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `firstName` VARCHAR(255) NOT NULL,
    `lastName` VARCHAR(255) NOT NULL,
    `email` VARCHAR(255) NULL,
    `mobileNumber` CHAR(11) NOT NULL,
    `address` TEXT NULL,
    `city` VARCHAR(100) NULL,
    `state` VARCHAR(100) NULL,
    `country` VARCHAR(100) NULL,
    `isActive` BOOLEAN NOT NULL DEFAULT true,
    `createdAt` TIMESTAMP(0) NULL,
    `updatedAt` TIMESTAMP(0) NULL,
    `deletedAt` TIMESTAMP(0) NULL,

    UNIQUE INDEX `Suppliers_mobileNumber_key`(`mobileNumber`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `Product_info` ADD CONSTRAINT `Product_info_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
