mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Format migrations
This commit is contained in:
@@ -6,7 +6,6 @@ CREATE TABLE "User" (
|
||||
"email" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -21,7 +20,6 @@ CREATE TABLE "BeerPost" (
|
||||
"typeId" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "BeerPost_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -33,7 +31,6 @@ CREATE TABLE "BeerComment" (
|
||||
"content" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "BeerComment_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -44,7 +41,6 @@ CREATE TABLE "BeerType" (
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
"postedById" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "BeerType_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -56,7 +52,6 @@ CREATE TABLE "BreweryPost" (
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
"postedById" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "BreweryPost_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -68,33 +63,59 @@ CREATE TABLE "BreweryComment" (
|
||||
"content" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "BreweryComment_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_breweryId_fkey" FOREIGN KEY ("breweryId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_breweryId_fkey" FOREIGN KEY ("breweryId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_typeId_fkey" FOREIGN KEY ("typeId") REFERENCES "BeerType"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_typeId_fkey" FOREIGN KEY ("typeId") REFERENCES "BeerType"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerComment" ADD CONSTRAINT "BeerComment_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerComment"
|
||||
ADD
|
||||
CONSTRAINT "BeerComment_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerComment" ADD CONSTRAINT "BeerComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerComment"
|
||||
ADD
|
||||
CONSTRAINT "BeerComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerType" ADD CONSTRAINT "BeerType_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerType"
|
||||
ADD
|
||||
CONSTRAINT "BeerType_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryPost" ADD CONSTRAINT "BreweryPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryPost"
|
||||
ADD
|
||||
CONSTRAINT "BreweryPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryComment" ADD CONSTRAINT "BreweryComment_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryComment"
|
||||
ADD
|
||||
CONSTRAINT "BreweryComment_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryComment" ADD CONSTRAINT "BreweryComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryComment"
|
||||
ADD
|
||||
CONSTRAINT "BreweryComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,18 +1,28 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `description` to the `BeerPost` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `description` to the `BreweryPost` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `dateOfBirth` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
Warnings:
|
||||
|
||||
- Added the required column `description` to the `BeerPost` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `description` to the `BreweryPost` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `dateOfBirth` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "BeerPost" ADD COLUMN "description" TEXT NOT NULL;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
COLUMN "description" TEXT NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "BreweryPost" ADD COLUMN "description" TEXT NOT NULL;
|
||||
ALTER TABLE
|
||||
"BreweryPost"
|
||||
ADD
|
||||
COLUMN "description" TEXT NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "dateOfBirth" TIMESTAMP(3) NOT NULL,
|
||||
ADD COLUMN "username" TEXT NOT NULL;
|
||||
ALTER TABLE
|
||||
"User"
|
||||
ADD
|
||||
COLUMN "dateOfBirth" TIMESTAMP(3) NOT NULL,
|
||||
ADD
|
||||
COLUMN "username" TEXT NOT NULL;
|
||||
@@ -1,26 +1,34 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerComment" DROP CONSTRAINT "BeerComment_beerPostId_fkey";
|
||||
ALTER TABLE
|
||||
"BeerComment" DROP CONSTRAINT "BeerComment_beerPostId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerComment" DROP CONSTRAINT "BeerComment_postedById_fkey";
|
||||
ALTER TABLE
|
||||
"BeerComment" DROP CONSTRAINT "BeerComment_postedById_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerPost" DROP CONSTRAINT "BeerPost_breweryId_fkey";
|
||||
ALTER TABLE
|
||||
"BeerPost" DROP CONSTRAINT "BeerPost_breweryId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerPost" DROP CONSTRAINT "BeerPost_postedById_fkey";
|
||||
ALTER TABLE
|
||||
"BeerPost" DROP CONSTRAINT "BeerPost_postedById_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerPost" DROP CONSTRAINT "BeerPost_typeId_fkey";
|
||||
ALTER TABLE
|
||||
"BeerPost" DROP CONSTRAINT "BeerPost_typeId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerType" DROP CONSTRAINT "BeerType_postedById_fkey";
|
||||
ALTER TABLE
|
||||
"BeerType" DROP CONSTRAINT "BeerType_postedById_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BreweryComment" DROP CONSTRAINT "BreweryComment_postedById_fkey";
|
||||
ALTER TABLE
|
||||
"BreweryComment" DROP CONSTRAINT "BreweryComment_postedById_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BreweryPost" DROP CONSTRAINT "BreweryPost_postedById_fkey";
|
||||
ALTER TABLE
|
||||
"BreweryPost" DROP CONSTRAINT "BreweryPost_postedById_fkey";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "BeerImage" (
|
||||
@@ -29,7 +37,6 @@ CREATE TABLE "BeerImage" (
|
||||
"url" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "BeerImage_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
@@ -40,36 +47,65 @@ CREATE TABLE "BreweryImage" (
|
||||
"url" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ(3),
|
||||
|
||||
CONSTRAINT "BreweryImage_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_breweryId_fkey" FOREIGN KEY ("breweryId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_breweryId_fkey" FOREIGN KEY ("breweryId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerPost" ADD CONSTRAINT "BeerPost_typeId_fkey" FOREIGN KEY ("typeId") REFERENCES "BeerType"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerPost"
|
||||
ADD
|
||||
CONSTRAINT "BeerPost_typeId_fkey" FOREIGN KEY ("typeId") REFERENCES "BeerType"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerComment" ADD CONSTRAINT "BeerComment_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerComment"
|
||||
ADD
|
||||
CONSTRAINT "BeerComment_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerComment" ADD CONSTRAINT "BeerComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerComment"
|
||||
ADD
|
||||
CONSTRAINT "BeerComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerType" ADD CONSTRAINT "BeerType_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerType"
|
||||
ADD
|
||||
CONSTRAINT "BeerType_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryPost" ADD CONSTRAINT "BreweryPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryPost"
|
||||
ADD
|
||||
CONSTRAINT "BreweryPost_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryComment" ADD CONSTRAINT "BreweryComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryComment"
|
||||
ADD
|
||||
CONSTRAINT "BreweryComment_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerImage" ADD CONSTRAINT "BeerImage_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerImage"
|
||||
ADD
|
||||
CONSTRAINT "BeerImage_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryImage" ADD CONSTRAINT "BreweryImage_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryImage"
|
||||
ADD
|
||||
CONSTRAINT "BreweryImage_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,17 +1,29 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BeerImage" DROP CONSTRAINT "BeerImage_beerPostId_fkey";
|
||||
ALTER TABLE
|
||||
"BeerImage" DROP CONSTRAINT "BeerImage_beerPostId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BreweryComment" DROP CONSTRAINT "BreweryComment_breweryPostId_fkey";
|
||||
ALTER TABLE
|
||||
"BreweryComment" DROP CONSTRAINT "BreweryComment_breweryPostId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BreweryImage" DROP CONSTRAINT "BreweryImage_breweryPostId_fkey";
|
||||
ALTER TABLE
|
||||
"BreweryImage" DROP CONSTRAINT "BreweryImage_breweryPostId_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryComment" ADD CONSTRAINT "BreweryComment_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryComment"
|
||||
ADD
|
||||
CONSTRAINT "BreweryComment_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BeerImage" ADD CONSTRAINT "BeerImage_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BeerImage"
|
||||
ADD
|
||||
CONSTRAINT "BeerImage_beerPostId_fkey" FOREIGN KEY ("beerPostId") REFERENCES "BeerPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BreweryImage" ADD CONSTRAINT "BreweryImage_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
"BreweryImage"
|
||||
ADD
|
||||
CONSTRAINT "BreweryImage_breweryPostId_fkey" FOREIGN KEY ("breweryPostId") REFERENCES "BreweryPost"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user