Rename pipeline schema (#184)

This commit is contained in:
Charles Bochet
2023-06-02 12:39:58 +02:00
committed by GitHub
parent 0609994477
commit f23bbb9a68
132 changed files with 2825 additions and 138 deletions

View File

@ -1,5 +1,5 @@
-- CreateEnum
CREATE TYPE "PipelineAssociableType" AS ENUM ('Person', 'Company');
CREATE TYPE "PipelineProgressableType" AS ENUM ('Person', 'Company');
-- CreateTable
CREATE TABLE "pipelines" (
@ -30,17 +30,17 @@ CREATE TABLE "pipeline_stages" (
);
-- CreateTable
CREATE TABLE "pipeline_associations" (
CREATE TABLE "pipeline_progresses" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deletedAt" TIMESTAMP(3),
"pipelineId" TEXT NOT NULL,
"pipelineStageId" TEXT NOT NULL,
"associableType" "PipelineAssociableType" NOT NULL,
"associableType" "PipelineProgressableType" NOT NULL,
"associableId" TEXT NOT NULL,
CONSTRAINT "pipeline_associations_pkey" PRIMARY KEY ("id")
CONSTRAINT "pipeline_progresses_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
@ -53,7 +53,7 @@ ALTER TABLE "pipeline_stages" ADD CONSTRAINT "pipeline_stages_pipelineId_fkey" F
ALTER TABLE "pipeline_stages" ADD CONSTRAINT "pipeline_stages_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "pipeline_associations" ADD CONSTRAINT "pipeline_associations_pipelineId_fkey" FOREIGN KEY ("pipelineId") REFERENCES "pipelines"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_pipelineId_fkey" FOREIGN KEY ("pipelineId") REFERENCES "pipelines"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "pipeline_associations" ADD CONSTRAINT "pipeline_associations_pipelineStageId_fkey" FOREIGN KEY ("pipelineStageId") REFERENCES "pipeline_stages"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_pipelineStageId_fkey" FOREIGN KEY ("pipelineStageId") REFERENCES "pipeline_stages"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -218,7 +218,7 @@ model Pipeline {
name String
icon String
pipelineStages PipelineStage[]
pipelineAssociations PipelineAssociation[]
pipelineProgresses PipelineProgress[]
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true, output: true)
@ -240,7 +240,7 @@ model PipelineStage {
pipelineId String
pipeline Pipeline @relation(fields: [pipelineId], references: [id])
pipelineAssociations PipelineAssociation[]
pipelineProgresses PipelineProgress[]
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
@ -250,12 +250,12 @@ model PipelineStage {
@@map("pipeline_stages")
}
enum PipelineAssociableType {
enum PipelineProgressableType {
Person
Company
}
model PipelineAssociation {
model PipelineProgress {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@ -267,8 +267,8 @@ model PipelineAssociation {
pipelineStageId String
pipelineStage PipelineStage @relation(fields: [pipelineStageId], references: [id])
associableType PipelineAssociableType
associableType PipelineProgressableType
associableId String
@@map("pipeline_associations")
@@map("pipeline_progresses")
}

View File

@ -76,7 +76,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
},
});
await prisma.pipelineAssociation.upsert({
await prisma.pipelineProgress.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
update: {},
create: {
@ -112,7 +112,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
},
});
await prisma.pipelineAssociation.upsert({
await prisma.pipelineProgress.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
update: {},
create: {
@ -200,7 +200,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
},
});
await prisma.pipelineAssociation.upsert({
await prisma.pipelineProgress.upsert({
where: { id: 'twenty-dev-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
update: {},
create: {