/* Warnings: - The primary key for the `Booking` table will be changed. If it partially fails, the table could be left without primary key constraint. - You are about to drop the column `billId` on the `Booking` table. All the data in the column will be lost. - The `id` column on the `Booking` table would be dropped and recreated. This will lead to data loss if there is data in the column. - A unique constraint covering the columns `[bookingId]` on the table `Bill` will be added. If there are existing duplicate values, this will fail. - Added the required column `bookingId` to the `Bill` table without a default value. This is not possible if the table is not empty. */ -- DropForeignKey ALTER TABLE "Booking" DROP CONSTRAINT "Booking_billId_fkey"; -- DropIndex DROP INDEX "Booking_billId_key"; -- AlterTable ALTER TABLE "Bill" ADD COLUMN "bookingId" INTEGER NOT NULL; -- AlterTable ALTER TABLE "Booking" DROP CONSTRAINT "Booking_pkey", DROP COLUMN "billId", DROP COLUMN "id", ADD COLUMN "id" SERIAL NOT NULL, ADD CONSTRAINT "Booking_pkey" PRIMARY KEY ("id"); -- CreateIndex CREATE UNIQUE INDEX "Bill_bookingId_key" ON "Bill"("bookingId"); -- AddForeignKey ALTER TABLE "Bill" ADD CONSTRAINT "Bill_bookingId_fkey" FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE RESTRICT ON UPDATE CASCADE;