feat: 增加管理员品牌归属关系
This commit is contained in:
1 parent
fef0a890ad
commit
ee3bd9051b
4 files changed
+52
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "BrandMembership" (
|
||||
"id" TEXT NOT NULL,
|
||||
"adminUserId" TEXT NOT NULL,
|
||||
"brandId" TEXT NOT NULL,
|
||||
"role" TEXT NOT NULL DEFAULT 'admin',
|
||||
"isEnabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "BrandMembership_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "BrandMembership_brandId_isEnabled_idx" ON "BrandMembership"("brandId", "isEnabled");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "BrandMembership_adminUserId_brandId_key" ON "BrandMembership"("adminUserId", "brandId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BrandMembership" ADD CONSTRAINT "BrandMembership_adminUserId_fkey" FOREIGN KEY ("adminUserId") REFERENCES "AdminUser"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BrandMembership" ADD CONSTRAINT "BrandMembership_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "BrandProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user