-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c0e0e2
commit b7f9e4c
Showing
3 changed files
with
193 additions
and
12 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
apps/api/prisma/migrations/20241217044750_create_code_review_request_table/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- CreateTable | ||
CREATE TABLE "CodeReviewRequest" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL, | ||
"deletedAt" TIMESTAMP(3), | ||
"pullRequestId" INTEGER NOT NULL, | ||
"reviewerId" INTEGER NOT NULL, | ||
"workspaceId" INTEGER NOT NULL, | ||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "CodeReviewRequest_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "CodeReviewRequest_workspaceId_idx" ON "CodeReviewRequest"("workspaceId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "CodeReviewRequest_reviewerId_idx" ON "CodeReviewRequest"("reviewerId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "CodeReviewRequest_pullRequestId_idx" ON "CodeReviewRequest"("pullRequestId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "CodeReviewRequest_pullRequestId_reviewerId_key" ON "CodeReviewRequest"("pullRequestId", "reviewerId"); | ||
|
||
-- RLS | ||
ALTER TABLE "CodeReviewRequest" ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE "CodeReviewRequest" FORCE ROW LEVEL SECURITY; | ||
CREATE POLICY tenant_isolation_policy ON "CodeReviewRequest" USING ("workspaceId" = current_setting('app.current_workspace_id', TRUE)::int); | ||
CREATE POLICY bypass_rls_policy ON "CodeReviewRequest" USING (current_setting('app.bypass_rls', TRUE)::text = 'on'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters