feat: 增加能力插件启停与审计
This commit is contained in:
1 parent
0fb96bdea3
commit
8a02d09e2d
6 files changed
+147
-1
No files matched your search
@@ -0,0 +1,35 @@
|
||||
-- DropIndex
|
||||
DROP INDEX "Booking_brandId_offeringId_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "BookingItem_offeringId_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "InquirySubmission_offeringId_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "BrandTemplateInstallation" ALTER COLUMN "configSnapshot" DROP DEFAULT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "InquirySubmission" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "CapabilityAuditLog" (
|
||||
"id" TEXT NOT NULL,
|
||||
"brandId" TEXT NOT NULL,
|
||||
"capabilityKey" TEXT NOT NULL,
|
||||
"actorId" TEXT NOT NULL,
|
||||
"action" TEXT NOT NULL,
|
||||
"fromStatus" TEXT,
|
||||
"toStatus" TEXT NOT NULL,
|
||||
"config" JSONB,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "CapabilityAuditLog_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "CapabilityAuditLog_brandId_capabilityKey_createdAt_idx" ON "CapabilityAuditLog"("brandId", "capabilityKey", "createdAt");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "CapabilityAuditLog" ADD CONSTRAINT "CapabilityAuditLog_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "BrandProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -59,6 +59,7 @@ model BrandProfile {
|
||||
inquiryForms InquiryForm[]
|
||||
inquirySubmissions InquirySubmission[]
|
||||
capabilityInstallations CapabilityInstallation[]
|
||||
capabilityAuditLogs CapabilityAuditLog[]
|
||||
}
|
||||
|
||||
model CapabilityInstallation {
|
||||
@@ -75,6 +76,20 @@ model CapabilityInstallation {
|
||||
@@index([brandId, status])
|
||||
}
|
||||
|
||||
model CapabilityAuditLog {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
capabilityKey String
|
||||
actorId String
|
||||
action String
|
||||
fromStatus String?
|
||||
toStatus String
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
@@index([brandId, capabilityKey, createdAt])
|
||||
}
|
||||
|
||||
model BrandTemplateInstallation {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
|
||||
Reference in new issue
Block a user