/*
  Warnings:

  - Added the required column `title` to the `SupplierAddress` table without a default value. This is not possible if the table is not empty.
  - Added the required column `title` to the `SupplierContact` table without a default value. This is not possible if the table is not empty.

*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_SupplierAddress" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "supplierId" INTEGER NOT NULL,
    "title" TEXT NOT NULL,
    "address" TEXT NOT NULL,
    "postalCode" TEXT NOT NULL,
    "city" TEXT NOT NULL,
    "country" TEXT NOT NULL,
    "published" BOOLEAN NOT NULL DEFAULT true,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL,
    CONSTRAINT "SupplierAddress_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "Supplier" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_SupplierAddress" ("address", "city", "country", "createdAt", "id", "postalCode", "published", "supplierId", "updatedAt") SELECT "address", "city", "country", "createdAt", "id", "postalCode", "published", "supplierId", "updatedAt" FROM "SupplierAddress";
DROP TABLE "SupplierAddress";
ALTER TABLE "new_SupplierAddress" RENAME TO "SupplierAddress";
CREATE TABLE "new_SupplierContact" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "supplierId" INTEGER NOT NULL,
    "title" TEXT NOT NULL,
    "firstname" TEXT NOT NULL,
    "lastname" TEXT NOT NULL,
    "email" TEXT NOT NULL,
    "phone" TEXT NOT NULL,
    "published" BOOLEAN NOT NULL DEFAULT true,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL,
    CONSTRAINT "SupplierContact_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "Supplier" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_SupplierContact" ("createdAt", "email", "firstname", "id", "lastname", "phone", "published", "supplierId", "updatedAt") SELECT "createdAt", "email", "firstname", "id", "lastname", "phone", "published", "supplierId", "updatedAt" FROM "SupplierContact";
DROP TABLE "SupplierContact";
ALTER TABLE "new_SupplierContact" RENAME TO "SupplierContact";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
