More work on beer image upload

patFix schema so beer image and brewery image have createdBy column. Rename 'url' to 'path' in schema, add 'caption' column.
This commit is contained in:
Aaron William Po
2023-02-11 21:42:22 -05:00
parent 45cc10a009
commit 912008e68d
17 changed files with 193 additions and 58 deletions

View File

@@ -0,0 +1,30 @@
/*
Warnings:
- You are about to drop the column `url` on the `BeerImage` table. All the data in the column will be lost.
- You are about to drop the column `url` on the `BreweryImage` table. All the data in the column will be lost.
- Added the required column `caption` to the `BeerImage` table without a default value. This is not possible if the table is not empty.
- Added the required column `path` to the `BeerImage` table without a default value. This is not possible if the table is not empty.
- Added the required column `postedById` to the `BeerImage` table without a default value. This is not possible if the table is not empty.
- Added the required column `caption` to the `BreweryImage` table without a default value. This is not possible if the table is not empty.
- Added the required column `path` to the `BreweryImage` table without a default value. This is not possible if the table is not empty.
- Added the required column `postedById` to the `BreweryImage` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "BeerImage" DROP COLUMN "url",
ADD COLUMN "caption" TEXT NOT NULL,
ADD COLUMN "path" TEXT NOT NULL,
ADD COLUMN "postedById" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "BreweryImage" DROP COLUMN "url",
ADD COLUMN "caption" TEXT NOT NULL,
ADD COLUMN "path" TEXT NOT NULL,
ADD COLUMN "postedById" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "BeerImage" ADD CONSTRAINT "BeerImage_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BreweryImage" ADD CONSTRAINT "BreweryImage_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;