File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
internal-packages/database/prisma
migrations/20250813103207_add_organization_access_token Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ CREATE TABLE "OrganizationAccessToken " (
2+ " id" TEXT NOT NULL ,
3+ " name" TEXT NOT NULL ,
4+ " encryptedToken" JSONB NOT NULL ,
5+ " obfuscatedToken" TEXT NOT NULL ,
6+ " hashedToken" TEXT NOT NULL ,
7+ " organizationId" TEXT NOT NULL ,
8+ " expiresAt" TIMESTAMP (3 ),
9+ " revokedAt" TIMESTAMP (3 ),
10+ " lastAccessedAt" TIMESTAMP (3 ),
11+ " createdAt" TIMESTAMP (3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ,
12+ " updatedAt" TIMESTAMP (3 ) NOT NULL ,
13+
14+ CONSTRAINT " OrganizationAccessToken_pkey" PRIMARY KEY (" id" )
15+ );
16+
17+ CREATE UNIQUE INDEX "OrganizationAccessToken_hashedToken_key " ON " OrganizationAccessToken" (" hashedToken" );
18+
19+ ALTER TABLE " OrganizationAccessToken" ADD CONSTRAINT " OrganizationAccessToken_organizationId_fkey" FOREIGN KEY (" organizationId" ) REFERENCES " Organization" (" id" ) ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change @@ -133,6 +133,33 @@ model PersonalAccessToken {
133133 authorizationCodes AuthorizationCode []
134134}
135135
136+ model OrganizationAccessToken {
137+ id String @id @default (cuid () )
138+
139+ /// User-provided name for the token
140+ name String
141+
142+ /// This is the token encrypted using the ENCRYPTION_KEY
143+ encryptedToken Json
144+
145+ /// This is shown in the UI, with ********
146+ obfuscatedToken String
147+
148+ /// This is used to find the token in the database
149+ hashedToken String @unique
150+
151+ organization Organization @relation (fields : [organizationId ] , references : [id ] )
152+ organizationId String
153+
154+ /// Optional expiration date for the token
155+ expiresAt DateTime ?
156+ revokedAt DateTime ?
157+ lastAccessedAt DateTime ?
158+
159+ createdAt DateTime @default (now () )
160+ updatedAt DateTime @updatedAt
161+ }
162+
136163model Organization {
137164 id String @id @default (cuid () )
138165 slug String @unique
@@ -174,6 +201,7 @@ model Organization {
174201 members OrgMember []
175202 invites OrgMemberInvite []
176203 organizationIntegrations OrganizationIntegration []
204+ organizationAccessTokens OrganizationAccessToken []
177205 workerGroups WorkerInstanceGroup []
178206 workerInstances WorkerInstance []
179207 executionSnapshots TaskRunExecutionSnapshot []
You can’t perform that action at this time.
0 commit comments