diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 9d52300fe..8b6036f95 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -364,6 +364,8 @@ type Team { children: [Team] createdAt: DateTime! description: String + flow: Flow + flowId: String goals: [Goal] id: Int! parent: Team diff --git a/graphql/types.ts b/graphql/types.ts index a3e911c62..9f10b5ec8 100644 --- a/graphql/types.ts +++ b/graphql/types.ts @@ -129,6 +129,8 @@ export const Team = objectType({ t.field(TeamModel.title); t.field(TeamModel.description); t.field(TeamModel.activityId); + t.field(TeamModel.flowId); + t.field('flow', { type: Flow }); t.field('activity', { type: Activity }); t.field('parent', { type: Team }); t.list.field('children', { type: Team }); diff --git a/prisma/migrations/20230112185149_/migration.sql b/prisma/migrations/20230112185149_/migration.sql new file mode 100644 index 000000000..0e28bb09e --- /dev/null +++ b/prisma/migrations/20230112185149_/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Team" ADD COLUMN "flowId" TEXT; + +-- AddForeignKey +ALTER TABLE "Team" ADD CONSTRAINT "Team_flowId_fkey" FOREIGN KEY ("flowId") REFERENCES "Flow"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 50536ae2c..b52b4e7ba 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -170,6 +170,8 @@ model Team { activityId String participants Activity[] @relation("teamParticipants") goals Goal[] @relation("teamGoals") + flow Flow? @relation(fields: [flowId], references: [id]) + flowId String? watchers Activity[] @relation("teamWatchers") stargizers Activity[] @relation("teamStargizers") @@ -272,6 +274,7 @@ model Flow { graph String? // [[stateId, stateId], [stateId, stateId]] — any transition allowed if undefined settings Settings[] projects Project[] + teams Team[] states State[] recommended Boolean?