Complete all standard object migration to the new workspace schema (#2492)

* Complete all standard object migration to the new workspace schema

* Fixes
This commit is contained in:
Charles Bochet 2023-11-14 10:24:36 +01:00 committed by GitHub
parent f476129afa
commit 5566e6fba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 531 additions and 51 deletions

View File

@ -100,7 +100,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'DATE',
name: 'reminderAt',
label: 'Reminder Date',
targetColumnMap: {
@ -116,7 +116,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'DATE',
name: 'dueAt',
label: 'Due Date',
targetColumnMap: {
@ -132,7 +132,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'DATE',
name: 'completedAt',
label: 'Completion Date',
targetColumnMap: {

View File

@ -57,7 +57,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'DATE',
name: 'expiresAt',
label: 'Expiration date',
targetColumnMap: {
@ -73,7 +73,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'DATE',
name: 'revokedAt',
label: 'Revocation date',
targetColumnMap: {

View File

@ -44,7 +44,7 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
type: 'NUMBER',
name: 'position',
label: 'Position',
targetColumnMap: {

View File

@ -46,7 +46,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'MONEY',
type: 'NUMBER',
name: 'amount',
label: 'Amount',
targetColumnMap: {
@ -78,7 +78,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'PROBABILITY',
type: 'TEXT',
name: 'probability',
label: 'Probability',
targetColumnMap: {

View File

@ -5,13 +5,13 @@ import { SeedWorkspaceId } from 'src/database/seeds/metadata';
const fieldMetadataTableName = 'fieldMetadata';
export enum SeedWorkspaceMemberSettingsFieldMetadataIds {
export enum SeedWorkspaceMemberSettingFieldMetadataIds {
ColorScheme = '20202020-d7b7-4f2e-bb52-90d3fd78007a',
Locale = '20202020-10f6-4df9-8d6f-a760b65bd800',
WorkspaceMember = '20202020-83f2-4c5f-96b0-0c51ecc160e3',
}
export const seedWorkspaceMemberSettingsFieldMetadata = async (
export const seedWorkspaceMemberSettingFieldMetadata = async (
workspaceDataSource: DataSource,
schemaName: string,
) => {
@ -36,8 +36,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
.values([
// Scalar fields
{
id: SeedWorkspaceMemberSettingsFieldMetadataIds.ColorScheme,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
id: SeedWorkspaceMemberSettingFieldMetadataIds.ColorScheme,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
@ -52,8 +52,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
isNullable: false,
},
{
id: SeedWorkspaceMemberSettingsFieldMetadataIds.Locale,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
id: SeedWorkspaceMemberSettingFieldMetadataIds.Locale,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
@ -61,7 +61,7 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
name: 'locale',
label: 'Language',
targetColumnMap: {
value: 'colorScheme',
value: 'locale',
},
description: 'Preferred language',
icon: 'IconLanguage',
@ -70,8 +70,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
// Relationships
{
id: SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
id: SeedWorkspaceMemberSettingFieldMetadataIds.WorkspaceMember,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,

View File

@ -6,6 +6,8 @@ import { SeedWorkspaceId } from 'src/database/seeds/metadata';
const fieldMetadataTableName = 'fieldMetadata';
export enum SeedWorkspaceMemberFieldMetadataIds {
FirstName = '20202020-1fa8-4d38-9fa4-0cf696909298',
LastName = '20202020-8c37-4163-ba06-1dada334ce3e',
AllowImpersonation = '20202020-bb19-44a1-8156-8866f87a5f42',
UserId = '20202020-f2c1-4ca1-9ca5-7b9d5cc87eb0',
AuthoredActivities = '20202020-37a0-4db4-9c9f-fd3e3f4e47fc',
@ -41,6 +43,38 @@ export const seedWorkspaceMemberFieldMetadata = async (
.orIgnore()
.values([
// Scalar fields
{
id: SeedWorkspaceMemberFieldMetadataIds.FirstName,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
name: 'firstName',
label: 'First name',
targetColumnMap: {
value: 'firstName',
},
description: 'Workspace member first name',
icon: 'IconCircleUser',
isNullable: false,
},
{
id: SeedWorkspaceMemberFieldMetadataIds.LastName,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
name: 'lastName',
label: 'Last name',
targetColumnMap: {
value: 'lastName',
},
description: 'Workspace member last name',
icon: 'IconCircleUser',
isNullable: false,
},
{
id: SeedWorkspaceMemberFieldMetadataIds.UserId,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
@ -166,10 +200,10 @@ export const seedWorkspaceMemberFieldMetadata = async (
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'RELATION',
name: 'settings',
name: 'setting',
label: 'Settings',
targetColumnMap: {
value: 'settingsId',
value: 'settingId',
},
description: 'Workspace member settings',
icon: 'IconSettings',

View File

@ -17,12 +17,12 @@ import { seedOpportunityFieldMetadata } from 'src/database/typeorm-seeds/metadat
import { seedPersonFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
import { seedPipelineStepFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/pipeline-step';
import { seedWorkspaceMemberFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
import { seedWorkspaceMemberSettingsFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
import { seedCompanyRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/company';
import { seedActivityRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/activity';
import { seedPipelineStepRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/pipeline-step';
import { seedPersonRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/person';
import { seedWorkspaceMemberRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/workspace-member';
import { seedWorkspaceMemberSettingFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-setting';
export const seedMetadataSchema = async (
workspaceDataSource: DataSource,
@ -46,7 +46,7 @@ export const seedMetadataSchema = async (
await seedViewSortFieldMetadata(workspaceDataSource, schemaName);
await seedViewRelationMetadata(workspaceDataSource, schemaName);
await seedWorkspaceMemberFieldMetadata(workspaceDataSource, schemaName);
await seedWorkspaceMemberSettingsFieldMetadata(
await seedWorkspaceMemberSettingFieldMetadata(
workspaceDataSource,
schemaName,
);

View File

@ -10,7 +10,7 @@ export enum SeedObjectMetadataIds {
Opportunity = '20202020-cae9-4ff4-9579-f7d9fe44c937',
PipelineStep = '20202020-1029-4661-9e91-83bad932bdcd',
WorkspaceMember = '20202020-b550-40bb-a96b-9ab54b664753',
WorkspaceMemberSettings = '20202020-166d-445c-970f-da1ea43f1dc7',
WorkspaceMemberSetting = '20202020-166d-445c-970f-da1ea43f1dc7',
Webhook = '20202020-ddee-40de-9c9b-5f82a3503360',
ApiKey = '20202020-d8d0-4c2d-a370-5499b2181d02',
Activity = '20202020-8ee3-4f67-84ab-1b7a6eb5a448',
@ -112,7 +112,7 @@ export const seedObjectMetadata = async (
isActive: true,
},
{
id: SeedObjectMetadataIds.WorkspaceMemberSettings,
id: SeedObjectMetadataIds.WorkspaceMemberSetting,
nameSingular: 'workspaceMemberSettingV2',
namePlural: 'workspaceMemberSettingsV2',
labelSingular: 'WorkspaceMemberSetting',

View File

@ -5,11 +5,11 @@ import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/objec
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
import { SeedWorkspaceMemberFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
import { SeedWorkspaceMemberSettingsFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
import { SeedActivityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity';
import { SeedCommentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/comment';
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
import { SeedWorkspaceMemberSettingFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-setting';
const tableName = 'relationMetadata';
@ -42,10 +42,10 @@ export const seedWorkspaceMemberRelationMetadata = async (
{
relationType: RelationMetadataType.ONE_TO_ONE,
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
toObjectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
toObjectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
fromFieldMetadataId: SeedWorkspaceMemberFieldMetadataIds.Settings,
toFieldMetadataId:
SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember,
SeedWorkspaceMemberSettingFieldMetadataIds.WorkspaceMember,
workspaceId: SeedWorkspaceId,
},
{

View File

@ -32,11 +32,6 @@ export const addCompanyTable: TenantMigrationTableAction[] = [
columnType: 'integer',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'linkedinUrl_link',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'linkedinUrl',
columnType: 'varchar',

View File

@ -17,6 +17,16 @@ export const addActivityTargetTable: TenantMigrationTableAction[] = [
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addActivityTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,47 @@ export const addActivityTable: TenantMigrationTableAction[] = [
{
name: 'activity',
action: 'alter',
columns: [],
columns: [
{
columnName: 'title',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'body',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'type',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'reminderAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'dueAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'completedAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'assigneeId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addApiKeyTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,22 @@ export const addApiKeyTable: TenantMigrationTableAction[] = [
{
name: 'apiKey',
action: 'alter',
columns: [],
columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'revokedAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'expiresAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -12,11 +12,41 @@ export const addAttachmentTable: TenantMigrationTableAction[] = [
name: 'attachment',
action: 'alter',
columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'fullPath',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'type',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'companyId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addCommentTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,22 @@ export const addCommentTable: TenantMigrationTableAction[] = [
{
name: 'comment',
action: 'alter',
columns: [],
columns: [
{
columnName: 'body',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -12,11 +12,26 @@ export const addFavoriteTable: TenantMigrationTableAction[] = [
name: 'favorite',
action: 'alter',
columns: [
{
columnName: 'position',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'companyId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'workspaceMemberId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -12,11 +12,41 @@ export const addOpportunityTable: TenantMigrationTableAction[] = [
name: 'opportunity',
action: 'alter',
columns: [
{
columnName: 'amount',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'probability',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'closeDate',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'companyId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'pipelineStepId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'pointOfContactId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -12,6 +12,51 @@ export const addPersonTable: TenantMigrationTableAction[] = [
name: 'person',
action: 'alter',
columns: [
{
columnName: 'firstName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'lastName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'email',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'linkedinUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'xUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'jobTitle',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'phone',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'city',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'avatarUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'companyId',
columnType: 'uuid',

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addPipelineStepTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,22 @@ export const addPipelineStepTable: TenantMigrationTableAction[] = [
{
name: 'pipelineStep',
action: 'alter',
columns: [],
columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'color',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'position',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWebhookTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,17 @@ export const addWebhookTable: TenantMigrationTableAction[] = [
{
name: 'webhook',
action: 'alter',
columns: [],
columns: [
{
columnName: 'targetUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'operation',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,22 @@ export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [
{
name: 'workspaceMemberSetting',
action: 'alter',
columns: [],
columns: [
{
columnName: 'colorScheme',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'locale',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'workspaceMemberId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [
{
@ -8,6 +11,32 @@ export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [
{
name: 'workspaceMember',
action: 'alter',
columns: [],
columns: [
{
columnName: 'firstName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'lastName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'allowImpersonation',
columnType: 'boolean',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'userId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'settingId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
},
];

View File

@ -14,6 +14,24 @@ export const addAttachmentRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -14,6 +14,18 @@ export const addFavoriteRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'workspaceMemberId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,37 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addOpportunityRelations: TenantMigrationTableAction[] = [
{
name: 'opportunity',
action: 'alter',
columns: [
{
columnName: 'companyId',
referencedTableName: 'company',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'pointOfContactId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'pipelineStepId',
referencedTableName: 'pipelineStep',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -14,6 +14,18 @@ export const addActivityTargetRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,25 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addActivityRelations: TenantMigrationTableAction[] = [
{
name: 'activity',
action: 'alter',
columns: [
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'assigneeId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,25 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addCommentRelations: TenantMigrationTableAction[] = [
{
name: 'comment',
action: 'alter',
columns: [
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,20 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberSettingRelations: TenantMigrationTableAction[] =
[
{
name: 'workspaceMemberSetting',
action: 'alter',
columns: [
{
columnName: 'workspaceMemberId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -3,14 +3,14 @@ import {
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addOpportunitiesRelations: TenantMigrationTableAction[] = [
export const addWorkspaceMemberRelations: TenantMigrationTableAction[] = [
{
name: 'opportunity',
name: 'workspaceMember',
action: 'alter',
columns: [
{
columnName: 'companyId',
referencedTableName: 'company',
columnName: 'settingId',
referencedTableName: 'workspaceMemberSetting',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},

View File

@ -14,8 +14,12 @@ import { addCompanyRelations } from 'src/metadata/tenant-migration/migrations/16
import { addAttachmentRelations } from 'src/metadata/tenant-migration/migrations/1697618028-addAttachmentRelations';
import { addPersonRelations } from 'src/metadata/tenant-migration/migrations/1697618029-addPersonRelations';
import { addFavoriteRelations } from 'src/metadata/tenant-migration/migrations/1697618030-addFavoriteRelations';
import { addOpportunitiesRelations } from 'src/metadata/tenant-migration/migrations/1697618031-addOpportunitiesRelations';
import { addActivityTargetRelations } from 'src/metadata/tenant-migration/migrations/1697618032-addActivityTargetRelations';
import { addActivityRelations } from 'src/metadata/tenant-migration/migrations/1697618033-addActivityRelations';
import { addCommentRelations } from 'src/metadata/tenant-migration/migrations/1697618034-addCommentRelations';
import { addOpportunityRelations } from 'src/metadata/tenant-migration/migrations/1697618031-addOpportunityRelations';
import { addWorkspaceMemberSettingRelations } from 'src/metadata/tenant-migration/migrations/1697618035-addWorkspaceMemberSettingRelations';
import { addWorkspaceMemberRelations } from 'src/metadata/tenant-migration/migrations/1697618036-addWorkspaceMemberRelations';
import { addCompanyTable } from './migrations/1697618009-addCompanyTable';
import { addViewTable } from './migrations/1697618011-addViewTable';
@ -47,6 +51,11 @@ export const standardMigrations = {
'1697618028-addAttachmentRelations': addAttachmentRelations,
'1697618029-addPersonRelations': addPersonRelations,
'1697618030-addFavoriteRelations': addFavoriteRelations,
'1697618031-addOpportunitiesRelations': addOpportunitiesRelations,
'1697618031-addOpportunitiesRelations': addOpportunityRelations,
'1697618032-addActivityTargetRelations': addActivityTargetRelations,
'1697618033-addActivityRelations': addActivityRelations,
'1697618034-addCommentRelations': addCommentRelations,
'1697618035-addWorkspaceMemberSettingRelations':
addWorkspaceMemberSettingRelations,
'1697618036-addWorkspaceMemberRelations': addWorkspaceMemberRelations,
};