| 1 | CREATE TABLE "organization_pinned_repository" ( |
| 2 | "organizationId" text NOT NULL |
| 3 | "repositoryId" text NOT NULL |
| 4 | "position" integer NOT NULL |
| 5 | CONSTRAINT "organization_pinned_repository_organizationId_repositoryId_pk" PRIMARY KEY |
| 6 | ); |
| 7 | --> statement-breakpoint |
| 8 | CREATE TABLE "organization_public_member" ( |
| 9 | "organizationId" text NOT NULL |
| 10 | "userId" text NOT NULL |
| 11 | CONSTRAINT "organization_public_member_organizationId_userId_pk" PRIMARY KEY |
| 12 | ); |
| 13 | --> statement-breakpoint |
| 14 | CREATE TABLE "organization_settings" ( |
| 15 | "organizationId" text PRIMARY KEY |
| 16 | "basePermission" "repository_role" DEFAULT |
| 17 | "membersCanCreatePublicRepositories" boolean DEFAULT |
| 18 | "membersCanCreatePrivateRepositories" boolean DEFAULT |
| 19 | "allowPrivateForks" boolean DEFAULT |
| 20 | "defaultBranch" text, |
| 21 | "description" text, |
| 22 | "website" text, |
| 23 | "location" text, |
| 24 | "email" text, |
| 25 | "updatedAt" timestamp with time zone DEFAULT |
| 26 | ); |
| 27 | --> statement-breakpoint |
| 28 | CREATE TABLE "repository_redirect" ( |
| 29 | "ownerName" text NOT NULL |
| 30 | "slug" text NOT NULL |
| 31 | "repositoryId" text NOT NULL |
| 32 | "createdAt" timestamp with time zone DEFAULT |
| 33 | ); |
| 34 | --> statement-breakpoint |
| 35 | CREATE TABLE "repository_transfer" ( |
| 36 | "repositoryId" text PRIMARY KEY |
| 37 | "toUserId" text, |
| 38 | "toOrganizationId" text, |
| 39 | "requestedById" text, |
| 40 | "createdAt" timestamp with time zone DEFAULT |
| 41 | ); |
| 42 | --> statement-breakpoint |
| 43 | CREATE TABLE "team_maintainer" ( |
| 44 | "teamId" text NOT NULL |
| 45 | "userId" text NOT NULL |
| 46 | CONSTRAINT "team_maintainer_teamId_userId_pk" PRIMARY KEY |
| 47 | ); |
| 48 | --> statement-breakpoint |
| 49 | ALTER TABLE "organization_pinned_repository" ADD |
| 50 | ALTER TABLE "organization_pinned_repository" ADD |
| 51 | ALTER TABLE "organization_public_member" ADD |
| 52 | ALTER TABLE "organization_public_member" ADD |
| 53 | ALTER TABLE "organization_settings" ADD |
| 54 | ALTER TABLE "repository_redirect" ADD |
| 55 | ALTER TABLE "repository_transfer" ADD |
| 56 | ALTER TABLE "repository_transfer" ADD |
| 57 | ALTER TABLE "repository_transfer" ADD |
| 58 | ALTER TABLE "repository_transfer" ADD |
| 59 | ALTER TABLE "team_maintainer" ADD |
| 60 | ALTER TABLE "team_maintainer" ADD |
| 61 | CREATE UNIQUE INDEX "repository_redirect_name_idx" ON |
| 62 | CREATE INDEX "repository_redirect_repository_idx" ON |
| 63 | -- Every existing organization gets its settings row, with the defaults a new one would have. |
| 64 | INSERT INTO "organization_settings" ("organizationId") |
| 65 | -- Organization roles are now member, admin and owner; repository access moved to the base permission. |
| 66 | UPDATE "member" SET "role |
| 67 | UPDATE "invitation" SET "role |