| 
 | 1 | +/*  | 
 | 2 | +  Warnings:  | 
 | 3 | +
  | 
 | 4 | +  - You are about to drop the column `addressId` on the `Account` table. All the data in the column will be lost.  | 
 | 5 | +  - You are about to drop the column `accountId` on the `Contact` table. All the data in the column will be lost.  | 
 | 6 | +  - You are about to drop the column `addressId` on the `Contact` table. All the data in the column will be lost.  | 
 | 7 | +  - You are about to drop the column `billingAddressId` on the `Quote` table. All the data in the column will be lost.  | 
 | 8 | +  - You are about to drop the column `shippingAddressId` on the `Quote` table. All the data in the column will be lost.  | 
 | 9 | +  - You are about to drop the `Address` table. If the table is not empty, all the data it contains will be lost.  | 
 | 10 | +
  | 
 | 11 | +*/  | 
 | 12 | +-- DropForeignKey  | 
 | 13 | +ALTER TABLE "Account" DROP CONSTRAINT "Account_addressId_fkey";  | 
 | 14 | + | 
 | 15 | +-- DropForeignKey  | 
 | 16 | +ALTER TABLE "Contact" DROP CONSTRAINT "Contact_accountId_fkey";  | 
 | 17 | + | 
 | 18 | +-- DropForeignKey  | 
 | 19 | +ALTER TABLE "Contact" DROP CONSTRAINT "Contact_addressId_fkey";  | 
 | 20 | + | 
 | 21 | +-- DropForeignKey  | 
 | 22 | +ALTER TABLE "Quote" DROP CONSTRAINT "QuoteBillingAddress_fk";  | 
 | 23 | + | 
 | 24 | +-- DropForeignKey  | 
 | 25 | +ALTER TABLE "Quote" DROP CONSTRAINT "QuoteShippingAddress_fk";  | 
 | 26 | + | 
 | 27 | +-- AlterTable  | 
 | 28 | +ALTER TABLE "Account" DROP COLUMN "addressId",  | 
 | 29 | +ADD COLUMN     "city" TEXT,  | 
 | 30 | +ADD COLUMN     "country" TEXT,  | 
 | 31 | +ADD COLUMN     "latitude" DOUBLE PRECISION,  | 
 | 32 | +ADD COLUMN     "longitude" DOUBLE PRECISION,  | 
 | 33 | +ADD COLUMN     "postalCode" TEXT,  | 
 | 34 | +ADD COLUMN     "state" TEXT,  | 
 | 35 | +ADD COLUMN     "street" TEXT;  | 
 | 36 | + | 
 | 37 | +-- AlterTable  | 
 | 38 | +ALTER TABLE "Contact" DROP COLUMN "accountId",  | 
 | 39 | +DROP COLUMN "addressId",  | 
 | 40 | +ADD COLUMN     "city" TEXT,  | 
 | 41 | +ADD COLUMN     "country" TEXT,  | 
 | 42 | +ADD COLUMN     "latitude" DOUBLE PRECISION,  | 
 | 43 | +ADD COLUMN     "longitude" DOUBLE PRECISION,  | 
 | 44 | +ADD COLUMN     "postalCode" TEXT,  | 
 | 45 | +ADD COLUMN     "state" TEXT,  | 
 | 46 | +ADD COLUMN     "street" TEXT;  | 
 | 47 | + | 
 | 48 | +-- AlterTable  | 
 | 49 | +ALTER TABLE "Quote" DROP COLUMN "billingAddressId",  | 
 | 50 | +DROP COLUMN "shippingAddressId",  | 
 | 51 | +ADD COLUMN     "billingCity" TEXT,  | 
 | 52 | +ADD COLUMN     "billingCountry" TEXT,  | 
 | 53 | +ADD COLUMN     "billingPostalCode" TEXT,  | 
 | 54 | +ADD COLUMN     "billingState" TEXT,  | 
 | 55 | +ADD COLUMN     "billingStreet" TEXT,  | 
 | 56 | +ADD COLUMN     "shippingCity" TEXT,  | 
 | 57 | +ADD COLUMN     "shippingCountry" TEXT,  | 
 | 58 | +ADD COLUMN     "shippingPostalCode" TEXT,  | 
 | 59 | +ADD COLUMN     "shippingState" TEXT,  | 
 | 60 | +ADD COLUMN     "shippingStreet" TEXT;  | 
 | 61 | + | 
 | 62 | +-- DropTable  | 
 | 63 | +DROP TABLE "Address";  | 
 | 64 | + | 
 | 65 | +-- CreateTable  | 
 | 66 | +CREATE TABLE "AccountContactRelationship" (  | 
 | 67 | +    "id" TEXT NOT NULL,  | 
 | 68 | +    "role" TEXT,  | 
 | 69 | +    "isPrimary" BOOLEAN NOT NULL DEFAULT false,  | 
 | 70 | +    "startDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,  | 
 | 71 | +    "endDate" TIMESTAMP(3),  | 
 | 72 | +    "description" TEXT,  | 
 | 73 | +    "accountId" TEXT NOT NULL,  | 
 | 74 | +    "contactId" TEXT NOT NULL,  | 
 | 75 | +    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,  | 
 | 76 | +    "updatedAt" TIMESTAMP(3) NOT NULL,  | 
 | 77 | + | 
 | 78 | +    CONSTRAINT "AccountContactRelationship_pkey" PRIMARY KEY ("id")  | 
 | 79 | +);  | 
 | 80 | + | 
 | 81 | +-- CreateIndex  | 
 | 82 | +CREATE INDEX "AccountContactRelationship_contactId_idx" ON "AccountContactRelationship"("contactId");  | 
 | 83 | + | 
 | 84 | +-- CreateIndex  | 
 | 85 | +CREATE INDEX "AccountContactRelationship_accountId_idx" ON "AccountContactRelationship"("accountId");  | 
 | 86 | + | 
 | 87 | +-- CreateIndex  | 
 | 88 | +CREATE UNIQUE INDEX "AccountContactRelationship_contactId_accountId_key" ON "AccountContactRelationship"("contactId", "accountId");  | 
 | 89 | + | 
 | 90 | +-- AddForeignKey  | 
 | 91 | +ALTER TABLE "AccountContactRelationship" ADD CONSTRAINT "AccountContactRelationship_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE;  | 
 | 92 | + | 
 | 93 | +-- AddForeignKey  | 
 | 94 | +ALTER TABLE "AccountContactRelationship" ADD CONSTRAINT "AccountContactRelationship_contactId_fkey" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE CASCADE;  | 
0 commit comments