This commit is contained in:
Your Name committed 2026-10-03 15:09:45 +07:00
1 parent b8a255821b
commit 46f09ab145
16 files changed
+2269 -186

No files matched your search

@@ -0,0 +1,23 @@
-- CreateTable
CREATE TABLE "CategorySection" (
"id" SERIAL NOT NULL,
"categoryId" INTEGER NOT NULL,
"type" TEXT NOT NULL,
"order" INTEGER NOT NULL,
"payload" JSONB NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"isLocked" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "CategorySection_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "CategorySection_categoryId_order_idx" ON "CategorySection"("categoryId", "order");
-- CreateIndex
CREATE INDEX "CategorySection_categoryId_isActive_idx" ON "CategorySection"("categoryId", "isActive");
-- AddForeignKey
ALTER TABLE "CategorySection" ADD CONSTRAINT "CategorySection_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+17
View File
@@ -42,6 +42,7 @@ model Category {
products Product[]
attributes AttributeDefinition[]
translations CategoryTranslation[]
sections CategorySection[]
deletedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -767,6 +768,22 @@ model ProductDetailSection {
@@index([productId, isActive])
}
model CategorySection {
id Int @id @default(autoincrement())
categoryId Int
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
type String
order Int
payload Json
isActive Boolean @default(true)
isLocked Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([categoryId, order])
@@index([categoryId, isActive])
}
model NewsletterSubscription {
id Int @id @default(autoincrement())
email String @unique