mirror of
https://github.com/DerTyp7/explainegy-nextjs.git
synced 2025-10-29 21:02:13 +01:00
asd
This commit is contained in:
40
prisma/migrations/20230122141410_contentable/migration.sql
Normal file
40
prisma/migrations/20230122141410_contentable/migration.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `typeId` on the `Article` table. All the data in the column will be lost.
|
||||
- You are about to drop the `ArticleType` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `ContentTableEntry` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `contentTable` to the `Article` table without a default value. This is not possible if the table is not empty.
|
||||
- Made the column `categoryId` on table `Article` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Article" DROP CONSTRAINT "Article_categoryId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Article" DROP CONSTRAINT "Article_typeId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ContentTableEntry" DROP CONSTRAINT "ContentTableEntry_articleId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Article" DROP COLUMN "typeId",
|
||||
ADD COLUMN "contentTable" JSONB NOT NULL,
|
||||
ADD COLUMN "imageId" INTEGER,
|
||||
ADD COLUMN "introduction" TEXT NOT NULL DEFAULT '',
|
||||
ALTER COLUMN "categoryId" SET NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Image" ADD COLUMN "alt" TEXT NOT NULL DEFAULT '';
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ArticleType";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ContentTableEntry";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Article" ADD CONSTRAINT "Article_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "Image"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Article" ADD CONSTRAINT "Article_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Article" ALTER COLUMN "contentTable" DROP NOT NULL;
|
||||
@@ -8,29 +8,18 @@ datasource db {
|
||||
}
|
||||
|
||||
model Article {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
title String @unique
|
||||
introduction String @default("")
|
||||
imageId Int?
|
||||
image Image? @relation(fields: [imageId], references: [id])
|
||||
markdown String
|
||||
contentTableEntries ContentTableEntry[]
|
||||
categoryId Int
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
dateCreated DateTime @default(now())
|
||||
dateUpdated DateTime @default(now())
|
||||
}
|
||||
|
||||
model ContentTableEntry {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
anchor String
|
||||
orderIndex Int
|
||||
articleId Int
|
||||
article Article @relation(fields: [articleId], references: [id])
|
||||
dateCreated DateTime @default(now())
|
||||
dateUpdated DateTime @default(now())
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
title String @unique
|
||||
introduction String @default("")
|
||||
imageId Int?
|
||||
image Image? @relation(fields: [imageId], references: [id])
|
||||
markdown String
|
||||
contentTable Json?
|
||||
categoryId Int
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
dateCreated DateTime @default(now())
|
||||
dateUpdated DateTime @default(now())
|
||||
}
|
||||
|
||||
model Category {
|
||||
|
||||
Reference in New Issue
Block a user