File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import { type MigrationExecutor } from '../pg-migrator' ;
2+
3+ export default {
4+ name : '2025.10.17T00-00-00.personal-access-tokens.ts' ,
5+ run : ( { sql } ) => sql `
6+ CREATE TABLE IF NOT EXISTS "personal_access_tokens" (
7+ "id" UUID PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4()
8+ , "organization_id" UUID NOT NULL REFERENCES "organizations" ("id") ON DELETE CASCADE
9+ , "user_id" UUID NOT NULL REFERENCES "users" ("id") ON DELETE CASCADE
10+ , "created_at" timestamptz NOT NULL DEFAULT now()
11+ , "title" text NOT NULL
12+ , "description" text NOT NULL
13+ , "permissions" text[] NOT NULL
14+ , "assigned_resources" jsonb
15+ , "hash" text NOT NULL
16+ , "first_characters" text NOT NULL
17+ );
18+
19+ CREATE INDEX IF NOT EXISTS "personal_access_tokens_organization_id" ON "personal_access_tokens" (
20+ "organization_id"
21+ , "user_id"
22+ , "created_at" DESC
23+ , "id" DESC
24+ );
25+ ` ,
26+ } satisfies MigrationExecutor ;
Original file line number Diff line number Diff line change @@ -167,5 +167,6 @@ export const runPGMigrations = async (args: { slonik: DatabasePool; runTo?: stri
167167 await import ( './actions/2025.05.15T00-00-00.contracts-foreign-key-constraint-fix' ) ,
168168 await import ( './actions/2025.05.15T00-00-01.organization-member-pagination' ) ,
169169 await import ( './actions/2025.05.28T00-00-00.schema-log-by-ids' ) ,
170+ await import ( './actions/2025.10.17T00-00-00.personal-access-tokens' ) ,
170171 ] ,
171172 } ) ;
You can’t perform that action at this time.
0 commit comments