Refactor: Morph strategy on PipelineProgress (#1065)

* Deprecate pipelineprogress backref on person to improve naming

* Remove deprecated point of contact fields

* Add company and person entities on pipelineprogress

* Migrate data from old progressable to new entity fields

* Codegen frontend

* Use company Id, deprecate progressableId

* Get rid of deprecated progressableId field

* Remove deprecated progressableType field from pipeline progress

* Remove useless migrations
This commit is contained in:
Emilien Chauvet
2023-08-03 18:08:35 +02:00
committed by GitHub
parent 4252a0a2c3
commit 21e3d8fcac
15 changed files with 327 additions and 263 deletions

View File

@ -89,8 +89,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
progressableType: 'Company',
progressableId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -102,8 +101,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-4a886c90-f4f2-4984-8222-882ebbb905d6',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe4-8998-b76aa0bfb600',
progressableType: 'Company',
progressableId: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102',
companyId: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -115,8 +113,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-af92f3eb-d51d-4528-9b97-b8f132865b00',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
progressableType: 'Company',
progressableId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -128,8 +125,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-08369b1a-acdb-43d6-95f9-67ac7436941a',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
progressableType: 'Company',
progressableId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -167,8 +163,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-a76aa0bfb600',
progressableType: 'Person',
progressableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
personId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -181,7 +176,6 @@ export const seedPipelines = async (prisma: PrismaClient) => {
name: 'Sales pipeline',
icon: '💰',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
pipelineProgressableType: 'Person',
},
});